[Insight-users] Black image.
Luis Ibanez
luis.ibanez at kitware.com
Tue Aug 3 00:25:45 EDT 2004
Hi Celina,
Since you are using the ConnectedThresholdImageFilter
in your pipeline, it is very likely that you are placing
seed points in regions of the image that do not satisfy
the intensity threhold criteria. In those circumstances
the region simply collapse.
Please verify the location of your seed points, and the
intensity of the image at those pixels, and let us know
what you find.
Thanks,
Luis
--------------------------------
Celina Redma wrote:
> Can anyone tell me what's wrong with the code? It gave me a black output
> image file. I try reading a dicom file and output a "png" file.
>
>
> typedef unsigned char InternalPixelType;
> typedef float floatPixelType;
> const unsigned int Dimension = 2;
>
> typedef itk::Image< InternalPixelType, Dimension > InternalImageType;
> typedef unsigned char OutputPixelType;
> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
> typedef itk::Image<floatPixelType, Dimension > floatImageType;
> typedef itk::CastImageFilter< InternalImageType, floatImageType >
> CastingToFloatType;
> CastingToFloatType::Pointer caster = CastingToFloatType::New();
> typedef itk::CastImageFilter<floatImageType, OutputImageType>
> CastingToCharType;
> CastingToCharType::Pointer caster2 = CastingToCharType::New();
>
> typedef itk::ImageFileReader< InternalImageType > ReaderType;
> typedef itk::ImageFileWriter< OutputImageType > WriterType;
> ReaderType::Pointer reader = ReaderType::New();
> WriterType::Pointer writer = WriterType::New();
> reader->SetFileName( argv[1] );
> writer->SetFileName( argv[2] );
>
> typedef itk::CurvatureFlowImageFilter< floatImageType, floatImageType
> > CurvatureFlowImageFilterType;
> CurvatureFlowImageFilterType::Pointer smoothing =
> CurvatureFlowImageFilterType::New();
> typedef itk::ConnectedThresholdImageFilter< floatImageType,
> floatImageType > ConnectedFilterType;
> ConnectedFilterType::Pointer connectedThreshold =
> ConnectedFilterType::New();
> caster->SetInput( reader->GetOutput() );
> smoothing->SetInput( caster->GetOutput() );
> connectedThreshold->SetInput( smoothing->GetOutput() );
> caster2->SetInput( connectedThreshold->GetOutput() );
> writer->SetInput( caster2->GetOutput() );
> smoothing->SetNumberOfIterations( 5 );
> smoothing->SetTimeStep( 0.125 );
> const InternalPixelType lowerThreshold = atof( argv[5] );
> const InternalPixelType upperThreshold = atof( argv[6] );
>
> connectedThreshold->SetLower( lowerThreshold );
> connectedThreshold->SetUpper( upperThreshold );
>
> connectedThreshold->SetReplaceValue( 255 );
> InternalImageType::IndexType index;
>
> index[0] = atoi( argv[3] );
> index[1] = atoi( argv[4] );
>
> connectedThreshold->SetSeed( index );
> try
> {
> writer->Update();
> }
> catch( itk::ExceptionObject & excep )
> {
> std::cerr << "Exception caught !" << std::endl;
> std::cerr << excep << std::endl;
> }
>
>
> return 0;
> }
>
>
> ------------------------------------------------------------------------
> Post your free ad now! *Yahoo! Canada Personals*
> <http://ca.personals.yahoo.com/>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
More information about the Insight-users
mailing list