SCIRun User Mailing List

Text archives Help


Re: [SCIRUN-USERS] Biomesh3d client


Chronological Thread 
  • From: Mariano Fernandez <marianofco@gmail.com>
  • To: Brett Burton <zaracay@gmail.com>
  • Cc: "scirun-users@sci.utah.edu List" <scirun-users@sci.utah.edu>, cleaver@sci.utah.edu, Sergei Turovets <sergei@cs.uoregon.edu>, Moritz Dannhauer <moritz@sci.utah.edu>, Dana Brooks <brooks@ece.neu.edu>, Rob MacLeod <macleod@sci.utah.edu>, Elizabeth Jurrus <liz@sci.utah.edu>
  • Subject: Re: [SCIRUN-USERS] Biomesh3d client
  • Date: Thu, 24 Mar 2016 16:15:15 -0300

Thank you Brett!

I'll follow your instructions and will let you know.

Bests,

Mariano.

2016-03-23 19:02 GMT-03:00 Brett Burton <zaracay@gmail.com>:
Mariano,

I've written up an appendix to the tutorial that I sent out earlier and have attached it to the email (as well as copied the text into the email below).  This appendix should address your first question regarding combining multiple sizing fields.  To expedite your implementation of the Appendix, I've also attached an example SCIRun network that combined 7 sizing fields.

Next, question b).  Smoothness of the final mesh is not determined by the sizing field.  The sizing field defines how coarse or refined your final mesh will be, but the mesh surfaces will conform to the original inputs you used to define your volumes.  So if your input volumes are coarse, the final mesh will be course.  To create smooth meshes, you will need to pass the original segmentation file through BioMesh3D and use the tight.nrrd outputs.  In the tutorial, it states that you should use tight-corrected.nrrd outputs.  This may be wrong, if I remember right, the tight.nrrd files are the final output of the BioMesh tightening step.

Consequently, Cleaver2 has implemented the first 4 stages of BioMesh, but you will need to have a SCIRun 4 build and the complete Qt5 package installed in order to use it.  

Brett




Appendix A: Combining multiple sizing fields (from 4.4.b)

Combining multiple sizing fields may be difficulty given that you need to scale and translate multiple
files while making sure that the sizing fields, at the intersecting surfaces of neighboring tissues, are the
same.

To do this you will need:
- each of the individual sizing fields for each tissue of interest
- the segmentation file (preferably aligned to the sizing fields, though this can be transformed if they
are not aligned).

1 - Open SCIRun

2 - Load segmentation and sizing field files (nrrds
a. Modules -> DataIO -> ReadField module
b. Click UI button (User Interface) on module
c. Change 'Files of Type' drop down to NrrdFile
d. Select nrrd file (segmentation file, not distance maps)

3 - Extract Min value of sizing field files
a. Modules -> Misc -> ReportFieldInfo

4 - Translate and Scale Sizing fields using Min sizing field values
a. Modules -> ChangeFieldData -> CalculateFieldData
b. Connect original Sizing field output to module
c. Connect ReportFieldInfo output port corresponding to Min data value (4th port from the left)
to matrix input port
d. Translate and Scale Data
i - Simple case -- no max sizing field constraint
RESULT = .25*(DATA - A) + .75;
-- Translation
DATA is the original sizing field
A is the min matrix value
(DATA - A)  zeros out the sizing field (translates to 0)
-- Scaling
.25  is the scaling factor (reducing the original sizing field by 1/4)
-- Additional Translation
.75 translates the sizing field again so that the min sizing field is 0.75
This MUST be done so that you don't have a 0 value for sizing
This would crash cleaver
You could also replace the .75 with a second input matrix
To do this you would have to use the CreateMatrix module to
define your min value.  If you did this, your equation would be
RESULT = .25*(DATA - A) + B;
ii - With max sizing field constraint -- this combines 4.4.b and 4.7.c
NEWDATA = .25*(DATA - A) + .75;
RESULT = select(NEWDATA>=1.0,1.0,NEWDATA);
-- Translation
DATA is the original sizing field
A is the min matrix value
(DATA - A)  zeros out the sizing field (translates to 0)
-- Scaling
.25  is the scaling factor (reducing the original sizing field by 1/4)
-- Additional Translation
.75 translates the sizing field again so that the min sizing field is 0.75
This MUST be done so that you don't have a 0 value for sizing
This would crash cleaver
You could also replace the .75 with a second input matrix
To do this you would have to use the CreateMatrix module to
define your min value.  If you did this, your equation would be
RESULT = .25*(DATA - A) + B;
-- Capping
The final RESULT scans the data to find the max value you want to 
define.  If it is above 1.0 (in this case) you will set the value to 1.0
otherwise, it will maintain the original value

5 - Combining Sizing Fields
The modules you use here are dependent on how many sizing fields you want to combine.  In
this example, we will have 7 sizing fields to combine.  This number is chosen to illustrate the 
need for multiple linked modules. If there are less than 4 modules, the steps a - c are all you
need.  If you have more than 8 you will need to repeat steps d - f
a. Modules -> ChangeFieldData -> CalculateFieldData5
b. Connect segmentation field  and 1st 4 modified Sizing fields outputs to module input ports
c. Combine first 4 sizing fields
RESULT = select(DATA1==0,-DATA2,
select(DATA1 == 1,-DATA3,
select(DATA1 == 2,-DATA4,
select(DATA1 == 3,-DATA5,DATA1))));
-- DATA1 is the segmentation (0 = air, 1 = tissue 1, 2 = tissue 2, etc...)
-- DATA2 is sizing field for air (DATA1 == 0)
The value is set to negative
This is done to prevent the results from having values that later match
the segmentation values of 1, 2, 3, 4
Negative values will not be segmentation label values
-- DATA3 is sizing field for tissue 1 (DATA1 == 1)
-- DATA4 is sizing field for tissue 2 (DATA1 == 2)
-- DATA5 is sizing field for tissue 3 (DATA1 == 3)
d. Combine additional 3 sizing fields
i. Modules -> ChangeFieldData -> CalculateFieldData4
RESULT = -select(DATA1==4,-DATA2,
select(DATA1==5,-DATA3,
select(DATA1==6,-DATA4,DATA1)));
-- DATA1 is the output of the previous
-- notice that there is a negative in front of select() function
this restores the sizing fields back to positive values.

6 - Optional additional translation
Sometimes their is further need to translate the entire field if your original translation was not 
large enough to make sizing fields of a reasonable value...to do this, open a new 
ClipFieldByFunction using the output of the above step as the input and use the function 
RESULT = DATA + [whatever value you want];

7 - Write out field
a. Modules -> DataIO -> WriteField module
b. Click UI button (User Interface) on module
c. Change 'Files of Type' drop down to NrrdFile
d. Select nrrd file (segmentation file, not distance maps)




On Mar 17, 2016, at 3:07 PM, Elizabeth Jurrus <liz@sci.utah.edu> wrote:

Hi everyone,

I'm adding cleaver to this mailing list to help with the windows crash in 3, below, and the sizing field parameters.

And I'm adding the scirun-users mailing list to help with sizing fields in SCIRun.

- liz


-------- Forwarded Message --------
Subject: Re: Biomesh3d client
Date: Thu, 17 Mar 2016 15:44:05 -0300
From: Mariano Fernandez <marianofco@gmail.com>
To: Moritz Dannhauer <moritz@sci.utah.edu>
CC: Sergei Turovets <sturovets@yahoo.com>, Dana Brooks <brooksdh@gmail.com>, Rob MacLeod <macleod@sci.utah.edu>, Elizabeth Jurrus <liz@sci.utah.edu>


Dear Moritz and Rob,

Thanks for your help. I found your tutorial "Meshing methods and instructions" were instructive.
This what I've tried until now (also for your records / debug):

1) The tetgen implementation in SCIRun 5 provided by Moriz runs with no errors. The resulting surfaces of the mesh are rather "voxelized" (not smooth, see attached). I tried to include smoothing (as described in the tutorial file in point 2.5) but the tetgen fails because of self intersecting facets, which is expected as described in your help (http://scirundocwiki.sci.utah.edu/SCIRunDocs/index.php/CIBC:Documentation:SCIRun:Reference:SCIRun:FairMesh). That's a known limitation of tetgen.

2) Biomesh alone (third method) is too slow (still running).

3) Cleaver + biomesh seems to be the best world (method number 4) in terms of quality elements, smooth surfaces and speed. I created the Sizing fileds using biomesh3d with the -s1:4 switch (as described in the tutorial). However, I couldn't make cleaver run in windows: in the verbose mode, and after "Creating Octree Mesh ..." the program terminates with no reason and no output.
So, I installed and compiled cleaver in a Virtual Machine with ubuntu 64 bits. I generated the sizing field with the Cleaver-gui and exported it as nrrd file. Then, in SCIRun I changed it by adding 1, 2, 3, 4, 5, and 10 units (as described in point 4.7.c). It works with plus3, plus4, plus5, and plus10. When adding one or 2, or even using the original unmodified Volume-sizing-field, cleaver crashes (just a "Killed" mesage on prompt) I assume it is because of memory requirements.

So, a couple of questions:

a) In point 4.4.b it says that "more info available if needed" in order to combine sizing fields. I would like to know how to combine the individual tissue sizing fields in SciRun to control them independently. So far, I've been only changing the full already combined and cleaver generated "volume sizing field".

b) The gray matter surfaces are still not as smooth as I would like (see "dents" in attached figures) and there is not much variation between "volume sizing field +5" and "volume sizing field +3" (see attached). Are these two effects expected? With lower sizing fields, is it expected that the GM surface gets smoother? Or is it already determined by the segmentation?

Thanks again,

Best regards,

Mariano.

2016-03-14 13:23 GMT-03:00 Moritz Dannhauer <moritz@sci.utah.edu>:
Hi Mariano, I will let you know once they bug-fixed it.
Find attached also some responses from another SCI user regarding your cleaver2 error messages and a short tutorial.

Best,
Moritz

On Mar 14, 2016, at 9:40 AM, Mariano Fernandez wrote:

> Thanks Moritz,
>
> Actually, tetgen is what I use (within the iso2mesh Matlab toolbox), but I will try your SCIRun 5 implementation. Please, let me know when you consider Cleaver 2 is ready.
>
> Bests,
>
> Mariano.


> It seems like this user is thinking that a coarse mesh would be more likely to complete.  That doesn't seem to be the case given the "default binary_dir = Model configuration file Files\SCIRun does not exist." line in his error message.  Besides, his computer would crash long (from memory hogging) before a week was up if Cleaver was working.
>
> In any case, here's a write-up of meshing steps that can be used, though I admit…I don't know much about using it on a windows machine.  This should still be up to date.
>

>
>


> Also…does he have the Cleaver documentation?  That would be able to explain the flags that he was asking about, but he should be aware that you can't define how many elements the mesher produces.  You have to set scaling parameters such that they create a coarser mesh, but you don't have direct control over the total number of elements, or the dimensions of them.





<Plus5.png><tetgen_in_SCIRun.png><Plus3.png>
________________________________________________
SCIRun users mailing list:  scirun-users@sci.utah.edu
http://www.sci.utah.edu/software/scirun.html
To unsubscribe, email sympa@lists.sci.utah.edu with the "unsubscribe scirun-users" in the message body.






Archive powered by MHonArc 2.6.18.

Top of page