[Insight-users] RelabelComponentImageFilter nothing at rendered
window..,
Luis Ibanez
luis.ibanez@kitware.com
Mon May 10 02:00:57 EDT 2004
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;
> typedef itk::ImageSeriesReader< InputImageType >
> ReaderType;
>
> itk::DICOMImageIO2::Pointer dicomIO =
> itk::DICOMImageIO2::New();
>
> // Get the DICOM filenames from the directory
> itk::DICOMSeriesFileNames::Pointer nameGenerator =
> itk::DICOMSeriesFileNames::New();
> CString directoryname(VolData_FName);
>
> std::string stringdirectory =
> directoryname.GetBuffer(200);
>
> // nameGenerator->SetDirectory( stringdirectory );
> it works!!!!!
>
> nameGenerator->SetDirectory(
> "D:/imagedata/Dicom/shy4" );
>
> typedef std::vector<std::string> seriesIdContainer;
> const seriesIdContainer & seriesUID =
> nameGenerator->GetSeriesUIDs();
> seriesIdContainer::const_iterator seriesItr =
> seriesUID.begin();
> seriesIdContainer::const_iterator seriesEnd =
> seriesUID.end();
> while( seriesItr != seriesEnd )
> {
> std::cout << seriesItr->c_str() << std::endl;
> seriesItr++;
> }
>
> typedef
> itk::RelabelComponentImageFilter<SegmentedImageType,SegmentedImageType>
> RelabelImageFilter;
> typedef std::vector<std::string> fileNamesContainer;
> fileNamesContainer fileNames;
> fileNames = nameGenerator->GetFileNames();
>
>
> ReaderType::Pointer reader = ReaderType::New();
> reader->SetFileNames( fileNames );
> reader->SetImageIO( dicomIO );
>
> reader->Update();
>
>
> CastImageFilterType::Pointer cast =
> CastImageFilterType::New();
>
> CurvatureFlowImageFilterType::Pointer smoothing =
> CurvatureFlowImageFilterType::New();
>
> ConfidenceConnectedImageFilterType::Pointer
> confidence =
> ConfidenceConnectedImageFilterType::New();
>
> ConnectedFilterType::Pointer connectedThreshold =
> ConnectedFilterType::New();
> RelabelImageFilter::Pointer rcfilter=
> RelabelImageFilter::New();
> VTK2ITKConnectorFilterType::Pointer VTK2ITKconnector
> =
> VTK2ITKConnectorFilterType::New();
>
>
>
> cast->SetInput( reader->GetOutput() );
>
> smoothing->SetInput( cast->GetOutput() );
> confidence->SetInput( smoothing->GetOutput());
>
> smoothing->SetTimeStep( 0.0625 );
> smoothing->SetNumberOfIterations( 2 );
> connectedThreshold->SetInput(
> smoothing->GetOutput() );
> connectedThreshold->SetLower( L_threshold );
> connectedThreshold->SetUpper( H_threshold);
> connectedThreshold->SetReplaceValue(
> SegmentedRegionColor );
>
>
> typedef ConnectedFilterType::IndexType IndexType;
> IndexType seed;
> seed[0] = axi;
> seed[1] = cron;
> seed[2] = sag;
>
> connectedThreshold->SetSeed( seed );
> ImageMomentsType::Pointer
> calculator=ImageMomentsType::New();
> connectedThreshold->Update();
> calculator->SetImage(
> connectedThreshold->GetOutput());
> calculator->Compute();
>
>
> ITK2VTKConnectorFilterType::Pointer ITK2VTKconnector
> =
> ITK2VTKConnectorFilterType::New();
> rcfilter->SetInput(connectedThreshold->GetOutput());
> rcfilter->Update();
> unsigned long nObjects =
> rcfilter->GetNumberOfObjects();
> const std::vector<unsigned long> sizeOfObjects =
> rcfilter->GetSizeOfObjectsInPixels();
> std::vector<unsigned long>::const_iterator it;
>
> int i;
> it = sizeOfObjects.begin();
> typedef itk::ImageFileWriter<SegmentedImageType>
> itkWriterType;
> typedef itk::DICOMImageIO2
> itkMetaImageIOType;
> itkMetaImageIOType::Pointer labellerMetaWriterIO =
> itkMetaImageIOType::New();
> itkWriterType::Pointer relabellerWriter =
> itkWriterType::New();
> itkMetaImageIOType::Pointer relabellerMetaWriterIO
> = itkMetaImageIOType::New();
> relabellerWriter->SetInput( rcfilter->GetOutput() );
> relabellerWriter->SetFileName(
> "c:/Shapes_relabelled.vtk" );
> relabellerWriter->SetImageIO( labellerMetaWriterIO );
> relabellerWriter->Write();
>
>
>
> ITK2VTKconnector->SetInput(connectedThreshold
> ->GetOutput()); //the region displayed ok but if
> rcfilter instead of connectedtehreshold nothing
> displayed..
>
> ITK2VTKconnector->GetImporter()->SetDataScalarTypeToUnsignedChar();
>
> /////To the Vtk pipeline...
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Win a $20,000 Career Makeover at Yahoo! HotJobs
> http://hotjobs.sweepstakes.yahoo.com/careermakeover
> _______________________________________________
> Insight-users mailing list
> Insight-users@itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list