[vtkusers] [Insight-users] visualization-problem after segmentation and cropping
Luis Ibanez
luis.ibanez at kitware.com
Sat May 29 11:25:34 EDT 2010
Hi Yusuf,
You can convert the pixel type of the Watershed output
by using the filter:
RelabelComponentImageFilter
http://www.itk.org/Doxygen/html/classitk_1_1RelabelComponentImageFilter.html
See comments below....
---------------------------------------------------------------------------------------
On Fri, May 28, 2010 at 2:43 PM, Yusuf OEZBEK <nasil122002 at yahoo.de> wrote:
> Hello Luis,
> I'm sorry, I have understood you wrong. Change of pixel-type in code does
> not work. I always get MET_ULONG_LONG. Also, Yes, I work with 64-bit
> machine.
> Am I doing something wrong in code?
>
>
> typedef itk::WatershedImageFilter<InternalImageType> WatershedFilterType;
> WatershedFilterType::Pointer watershedFilter = WatershedFilterType::New();
> watershedFilter->SetInput(gradienMagnitudeFilter->GetOutput());
> watershedFilter->SetThreshold(this->sliderThresholdWatershed->value());
> watershedFilter->SetLevel(this->sliderLevelWatershed->value());
> // typedef WatershedFilterType::OutputImageType LabeledImageType;
>
> typedef itk::ImageFileWriter< OutputImageType > WriterType;
> WriterType::Pointer writer = WriterType::New();
> writer->SetInput( watershedFilter->GetOutput() );
> writer->SetFileName("Watershed.mhd");
> writer->Write();
>
> ------------------------------------------------------------------------
// Add the following
typedef itk::Image< unsigned short, Dimension > ShortImageType;
typedef itk::RelabelComponentImageFilter<
LabeledImageType, ShortImageType > RelabelFilterType;
RelabelFilterType::Pointer relabelFilter = RelabelFilterType::New();
relabelFilter->SetInput( watershedFilter->GetOutput() );
....
Then use the output of the relabelFilter, instead
of using the output of the watershedFilter.
In this way, the pixel type of the image will become 16 bits,
the labels will be mapped into that numerical range, and
you should then be able to use that image in VTK.
Regards,
Luis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100529/36bd481a/attachment.htm>
More information about the vtkusers
mailing list