[Insight-users] RelabelComponentImageFilter nothing at rendered window..,

Luis Ibanez luis.ibanez at kitware.com
Mon May 31 10:51:39 EDT 2004


Hi Yasser,


This is more a VTK issue than an ITK one.
You may want to follow it on the VTK users list.

--

In any case,

If you want to overlay the segmentation using a
particular color, then you might want to use the
VTK filter vtkImageMapToColors

http://www.vtk.org/doc/nightly/html/classvtkImageMapToColors.html

on the output of segmentation and then pass the
result as one of the inputs to the vtkBlend filter.


The ITK + VTK pipeline will look like:



ITKsegmenter--> ITK2VTK(a) -->vtkImageMapToColors
                                    |
                                    |
                                    V
                               vtkBlendFilter--->> To Viewer
                                    ^
                                    |
                                    |
ITKReaser--> ITK2VTK(b) -----------+



Note that you must provide a vtkLookupTable class to
the vtkImageMapToColors filter in order to define the
set of colors of your preference.



   Regards,


      Luis



-----------------------
yasser salman wrote:

> hi luis .,
> thanx for ur reply , i try this code but segmented
> region not colored still have the gray level (like the
> whole Brain), i think the fault may be in my itk
> scaling , i 'll try it again , plz if u have any
> suggestion informe me as soon as u can.., 
> thanks again Luis..,
> regards'  
> yasser..,\
> --- Luis Ibanez <luis.ibanez at kitware.com> wrote:
> 
>>Hi Yasser,
>>
>>Please look at the following code taken from IGSTK
>>(The Image Guided Surgery Toolkit based on ITK+VTK).
>>
>>This code was contributed as a demo application to
>>ITK.
>>You will find this program in
>>
>>         InsightApplications/
>>                 LiverTumorSegmentation/
>>                        LiverTumorSegmentation.cxx
>>
>>
>>---
>>
>>
>>typedef unsigned char  VisualizationPixelType;
>>typedef itk::Image< VisualizationPixelType, 3 >
>>VisualizationVolumeType;
>>
>>typedef itk::ImageToVTKImageFilter<
>>                  VisualizationVolumeType >  
>>ITK2VTKAdaptorFilterType;
>>
>>m_vtkImageBlender = vtkImageBlend::New();
>>
> 
> m_vtkImageBlender->SetInput(0,m_ITK2VTKAdaptor->GetOutput());
> 
>>
> m_vtkImageBlender->SetInput(1,m_SegmentedVolumeITK2VTKAdaptor->GetOutput());
> 
>>m_vtkImageBlender->SetOpacity(0, 1.0 -
>>m_SegmentedVolumeOpacity );
>>m_vtkImageBlender->SetOpacity(1,
>>m_SegmentedVolumeOpacity );
>>
>>
>>/* Put on Image Blending with Input and Segmented
>>image. */
>>m_ShiftScaleImageFilter = vtkImageShiftScale::New();
>>m_ShiftScaleImageFilter->SetInput(
>>m_vtkImageBlender->GetOutput() );
>>m_ShiftScaleImageFilter->UpdateWholeExtent();
>>
> 
> m_ShiftScaleImageFilter->SetOutputScalarTypeToUnsignedChar();
> 
>>m_ShiftScaleImageFilter->ClampOverflowOn();
>>
>>
>>
>>
>>  Regards,
>>
>>
>>
>>     Luis
>>
>>
>>
>>---------------------
>>yasser salman wrote:
>>
>>
>>>hi Luis ,
>>>i sent this message without my result coz the
>>
>>result
>>
>>>size exceeds the limitation of 40K , i'm still
>>
>>wait
>>
>>>the approval but any way if u can help me to fix
>>
>>my
>>
>>>problem without result here is my message without
>>>result.., 
>>>i rescale (as u suggested) the volume and it works
>>
>>:) 
>>
>>>but i still stucked at the colored region :( the
>>>attchment file represents my results , all i need 
>>
>>(as
>>
>>>seen in fig 1 lower part) to color the segmented
>>>region , i try to color it using :
>>>1- itkRelabelComponentImageFilter the color
>>
>>segmented
>>
>>>region displayed but using the saved file only !!!
>>
>>Fig
>>
>>>2.  
>>>2-itkFunctorScalarToRGBPixelFunctor same as
>>
>>itkRelable
>>
>>>the output Direct from the filter represented by
>>
>>fig 1
>>
>>>, from saved file represented from fig 2., 
>>>3- vtkImageMapToColor the output seems as Grids,
>>>sorry Luis for these extented details , but i
>>
>>stucked
>>
>>>for a long time solving this problem ,i posted
>>
>>below
>>
>>>my modified code ,,
>>>
>>>
>>>--- Luis Ibanez <luis.ibanez at kitware.com> wrote:
>>>
>>>
>>>>Hi Yasser,
>>>>
>>>>The Relabel image filter assigns values like :
>>>>1,2,3....
>>>>
>>>>to the pixels in the image.  Those values will
>>>>appear very dark in any viewer unless you rescale
>>>>them before attempting to visualize them.
>>>>
>>>>
>>>
>>>
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1RelabelComponentImageFilter.html
> 
>>>>Since you are using VTK for visualization, you
>>>>simply
>>>>need to adjust the parameters of intensity
>>
>>windowing
>>
>>>>in your viewer.
>>>>
>>>>
>>>>
>>>>  Regards,
>>>>
>>>>
>>>>    Luis
>>>>
>>>>
>>>>----------------------
>>>>yasser salman wrote:
>>>>
>>>>
>>>>>Hi All..,
>>>>>
>>>>>when i'm using  itkRelabelComponentImageFilter as
>>>>
>>>>the
>>>>
>>>>
>>>>>input to the writer the file saved and i can
>>>>
>>>>display
>>>>
>>>>
>>>>>it clearly also GetSizeOfObjectsInPixels() works
>>>>
>>>>good,
>>>>
>>>>
>>>>>but when i'm using it as the input of of
>>>>>itk2vtkconnector nothing displayed in the render
>>>>>window can u find out why?
>>>>>
>>>>>
>>>
>>>
>>> typedef unsigned short   InputPixelType;
>>>  typedef float        InternalPixelType;
>>>  
>>>  typedef unsigned short   SegmentedPixelType;
>>>
>>>  typedef itk::Image< InputPixelType, 3 >        
>>>InputImageType;
>>>  typedef itk::Image< InternalPixelType, 3>      
>>>InternalImageType;
>>>
>>>  typedef itk::Image< SegmentedPixelType, 3 >    
>>>SegmentedImageType;
>>>
>>>  typedef   itk::CastImageFilter< 
>>>                 InputImageType, 
>>>                 InternalImageType >    
>>>CastImageFilterType;
>>>
>>>  typedef   itk::CurvatureFlowImageFilter< 
>>>                 InternalImageType, 
>>>                 InternalImageType >    
>>>CurvatureFlowImageFilterType;
>>>
>>>  typedef   itk::ConfidenceConnectedImageFilter< 
>>>                         InternalImageType, 
>>>                         SegmentedImageType >     
>>>				 ConfidenceConnectedImageFilterType;
>>>
>>>  typedef itk::ConnectedThresholdImageFilter< 
>>>			InternalImageType, SegmentedImageType >
>>>ConnectedFilterType;
>>>  
>>>
>>>  typedef itk::ImageToVTKImageFilter<
>>>SegmentedImageType >  
>>>			ITK2VTKConnectorFilterType;
>>>
>>>  typedef itk::VTKImageToImageFilter<
>>
>>InputImageType  
>>
>>>  >  
>>>            VTK2ITKConnectorFilterType;
>>>	   typedef itk::ImageSeriesReader< InputImageType
>>> 
>>>  ReaderType;
>>>  typedef std::vector<std::string>
>>
>>seriesIdContainer;
>>
>>>  typedef std::vector<std::string>
>>
>>fileNamesContainer;
>>
>>>  typedef ConnectedFilterType::IndexType
>>
>>IndexType;	
>>
>>>  typedef
>>>itk::ImageMomentsCalculator<SegmentedImageType>
>>>ImageMomentsType;
>>
> === message truncated ===
> 
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/ 
> 





More information about the Insight-users mailing list