[Insight-users] How to draw segmented contour in ThresholdSegmentationLevelSetFltkGui

Luis Ibanez luis.ibanez at kitware.com
Mon, 05 Jan 2004 11:22:08 -0500


Hi Chunyan,

This application is casting the image because the
SliceViewe class used for visualization is expecting
the overlay image to be of pixel type "unsigned char".

For understanding how the red contour line is drawn
please look at the code of the GlSliceView and SliceView
classes in

     InsightApplications/Auxiliary/FltkImageViewer

Note that the trick is to threshold the level set in order
to get a thin band around the zero set. (using thresholds
lower and upper = -0.5 and 0.5 respectively).

If you are using Qt instead of FLTK, you may want to look
at the code of the QtImageViewer in

    InsightApplications/Auxiliary

Where you will find the Qt equivalent of the FltkImageViewer.


--

For the long run you may find more interesting to use VTK for
visualizing the images. For example, you will find easier to do
this visualization by converting the level set to a VTK image
(vtkImageData) by using the classes in

    InsightApplications/Auxiliary/vtk

                itkImageToVTKImageFilter
                itkVTKImageToImageFilter

and following the instructions in the Tutorial sessions

     http://www.itk.org/HTML/Tutorials.htm

in particular:

   http://www.itk.org/CourseWare/Training/GettingStarted-II.pdf

Then use the vtkContourFilter in order to generate a contour
at the zero set level (by just using 0.0 as the contour level),
and use a VTK visualization pipeline as illustrated in the PDF
document above.

For Qt-VTK classes allowing to display a VTK window in the
middle of a Qt GUI you may look at Sebastien's pages

      http://www.barre.nom.fr/vtk/links-classes.html#qt



Regards,


    Luis



---------------------
jiang wrote:

> Dear ITK users,
> As Luis recommended, I use ThresholdSegmentationLevelSetFltkGui to do the
> segmentation in one image. It is a very good application. And I look into
> its code. I find that it uses
>   typedef   itk::BinaryThresholdImageFilter<
>                             InputImageType,
>                             WriteImageType >   BinaryThresholdType;
>   typedef   itk::CastImageFilter<
>                             WriteImageType,
>                             WriteImageType3D > SegmentedCasterType;
> 
> to cast the segmented image from InputImageType <float,2> to
> WriteImageType3D<unsigned char,3>, and show it by
> m_InputViewer->SetOverlay(m_SegmentedCaster->GetOutput());
> I don't know why it casts the image to WriteImageType3D, and how
> m_InputViewer draws the red contour line. I want to use Qt to draw the
> segmented contour. How should I do?
> 
> Thank you very much!
> 
> 
> Chunyan
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>