<br>Hi Yusuf,<br><br>You can convert the pixel type of the Watershed output<br>by using the filter:<br><br> RelabelComponentImageFilter<br><br><a href="http://www.itk.org/Doxygen/html/classitk_1_1RelabelComponentImageFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1RelabelComponentImageFilter.html</a><br>
<br>See comments below....<br><br>---------------------------------------------------------------------------------------<br><div class="gmail_quote">On Fri, May 28, 2010 at 2:43 PM, Yusuf OEZBEK <span dir="ltr"><<a href="mailto:nasil122002@yahoo.de">nasil122002@yahoo.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div style=""><div>Hello Luis,<br></div><div></div><div>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.</div>
<div>Am I doing something wrong in code?</div><div></div><div><br> <br> typedef itk::WatershedImageFilter<InternalImageType> WatershedFilterType;<br> WatershedFilterType::Pointer watershedFilter =
WatershedFilterType::New();<br> watershedFilter->SetInput(gradienMagnitudeFilter->GetOutput());<br> watershedFilter->SetThreshold(this->sliderThresholdWatershed->value());<br> watershedFilter->SetLevel(this->sliderLevelWatershed->value());<br>
//         typedef WatershedFilterType::OutputImageType LabeledImageType;<br> <br> typedef itk::ImageFileWriter< OutputImageType > WriterType;<br> WriterType::Pointer writer = WriterType::New();<br> writer->SetInput( watershedFilter->GetOutput() );<br>
writer->SetFileName("Watershed.mhd");<br> writer->Write();<br><br></div></div></div></blockquote></div>------------------------------------------------------------------------<br><br>// Add the following<br>
typedef itk::Image< unsigned short, Dimension > ShortImageType;<br><br>typedef itk::RelabelComponentImageFilter< <br> LabeledImageType, ShortImageType > RelabelFilterType;<br><br>RelabelFilterType::Pointer relabelFilter = RelabelFilterType::New();<br>
<br>relabelFilter->SetInput( watershedFilter->GetOutput() );<br><br><br>....<br><br>Then use the output of the relabelFilter, instead<br>of using the output of the watershedFilter.<br><br>In this way, the pixel type of the image will become 16 bits,<br>
the labels will be mapped into that numerical range, and<br>you should then be able to use that image in VTK.<br><br><br> Regards,<br><br><br> Luis<br><br><br>