[Insight-users] [Insight-developers] two-input filters don't work
Kevin H. Hobbs
hobbsk at ohiou.edu
Fri Sep 18 17:44:20 EDT 2009
The first problem that I see is that you only sent a part of the code so
nobody will be able to tell if your DICOM reader is set up correctly.
You are still doing too much at once. This is fine for the example which
must be a self contained program, and for a final segmentation
application, but it's an awful way to learn what's going on. Also I find
that for large 3d images the first smoothing step can take a very long
time and it would be a shame to have to redo it every time you want to
change a downstream parameter. I've broken the example up into several
small programs.
Writing to PNG files is a problem for two reasons :
The files are only 2d you will not be able to examine the intermediate
results for a whole 3d image. That is unless you replace the writer with
a series writer and write to a series of PNG files but it's easier to
just use the MHD format.
When you write to a PNG file the pixel type is restricted to unsigned
char. Not only do you loose precision but you loose the sign of the
data. This is important when you set the value of the fast marching seed
to a negative number. You should be able to confirm that the zero level
is near the boundary of the object you want to segment.
Now in the GIMP I converted the input image you posted before to gray
scale and cut off the excess.
http://crab-lab.zool.ohiou.edu/kevin/two-input_filters/0_input.png
I smoothed it with the program I sent
./Smooth 0_input.png 0.125 5 9.0 tmp/smoothed.mhd
and rendered it in paraview
http://crab-lab.zool.ohiou.edu/kevin/two-input_filters/smoothed.png
I took the gradient magnitude
./GradMag tmp/smoothed.mhd 1.0 tmp/grad_mag.mhd
and rendered it in paraview
http://crab-lab.zool.ohiou.edu/kevin/two-input_filters/grad_mag.png
I flipped and scaled the gradient magnitude with the sigmoid filter
./Sigmoid tmp/grad_mag.mhd -0.5 1.0 tmp/sig.mhd
and rendered it in paraview
http://crab-lab.zool.ohiou.edu/kevin/two-input_filters/sig.png
I used the fast marching filter to get a time crossing map
./Fast tmp/sig.mhd 263.36 184.04 tmp/fast.mhd
and rendered it in paraview
http://crab-lab.zool.ohiou.edu/kevin/two-input_filters/fast.png
where I chose the level t=100 shown in green as the IsoSurfaceValue for
the initial level set.
I used the shape detection filter to bring the initial levelset closer
to the boundaries.
./Shape tmp/sig.mhd tmp/fast.mhd 100 0.05 1 tmp/shape.mhd
and rendered it in paraview
http://crab-lab.zool.ohiou.edu/kevin/two-input_filters/shape.png
In paraview I rendered the smoothed image, the t=100 level in green, and
the zero-level from the shape detection filter in blue.
http://crab-lab.zool.ohiou.edu/kevin/two-input_filters/compare.png
I hope this gets you closer to your goal.
Keep us updated!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMakeLists.txt
Type: text/x-cmake
Size: 566 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090918/8c68e4f1/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fast.cxx
Type: text/x-c++src
Size: 1764 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090918/8c68e4f1/attachment-0005.cxx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GradMag.cxx
Type: text/x-c++src
Size: 1371 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090918/8c68e4f1/attachment-0006.cxx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Shape.cxx
Type: text/x-c++src
Size: 1807 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090918/8c68e4f1/attachment-0007.cxx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sigmoid.cxx
Type: text/x-c++src
Size: 1467 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090918/8c68e4f1/attachment-0008.cxx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Smooth.cxx
Type: text/x-c++src
Size: 1573 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090918/8c68e4f1/attachment-0009.cxx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090918/8c68e4f1/attachment-0001.pgp>
More information about the Insight-users
mailing list