[Insight-users] Re: Help with ITK Filters : FastMarching requires seed points & speed image

Luis Ibanez luis . ibanez at kitware . com
Tue, 11 Nov 2003 00:11:31 -0500


Hi Giancarlo,


1)  In your code example, you are using the FastMarching
     image filter, but you haven't provided any seed points
     for it, nor computed the speed image for its input.

     It is normal in such circumstances for this filter to
     produce a black image.

     Please read the description of this filter in the
     SoftwareGuide.

          http://www . itk . org/ItkSoftwareGuide . pdf

     Section 9.3.1, pdf-page 365, paper-page 391

     You may also want to experiment with the associated
     example in

  Insight/Examples/Segmentation/FastMarchingImageFilter.cxx


     and/or with the Demo application

         InsightApplications/FastMarchingLevelSet



2) It is quite common to obtain 'black' images when you
    save your data in 16bits PNG files.
    What usually happens is that you image is there but
    probably in a range the intensities [0:255] that with
    respect to the total range of 16 bits [0:65535] looks
    totally dark.

    The solution is to save your data using an ImageFile
    Writer instantiated over an image of 8 bits.

    In case rescaling is necessary, you can use the
    RescaleIntensityImageFilter, that is described
    in the SoftwareGuide

       http://www . itk . org/ItkSoftwareGuide . pdf

    in Section 6.2.1, pdf-page 146, paper-page 172.




3) You can read raw data into ITK by simply writing
    a MetaImage header for your file. You can generate
    this header with the helper application:

     MetaImageImporter

     available in InsightApplications/MetaImageImporter.





Please let us know if you have further questions.


   Thanks


    Luis



---------------------------
Giancarlo Amati wrote:
> Hello Luis,
> Thank you for your past answers, the really helped me in my work. Now I
> was trying some of the filters that ITK give me, but I have some
> problems, some filter seems to work well, but some others return me a
> totally black image, so I do not understand if the problems regards the
> image file format (i use .raw images) or I have to convert my images in
> some other format. Anyway I will write you a code sample, it regards the
> usage of some filter that return me a black image. In n the following
> there is my example code, I build my volume reading .raw images by vtk
> function.
> Thank you very much for your kindness and I'm apologiezed to disturb
> you.
> 
> Best Regards.
> Giancarlo Amati
> 
> vtkVolume16Reader *reader = vtkVolume16Reader::New();
> 		reader->SetDataByteOrderToLittleEndian();
> 		reader->SetDataDimensions (512,512);
> 		reader->SetImageRange(20, 25);
> 		reader->SetDataSpacing(1.0, 1.0, 4.0); // z = 4.0 e'
> corretto
> 	
> reader->SetFilePattern("C:/MedData/Dati/%s%03d_512x512.raw");
> 		reader->SetFilePrefix("img");
> 		reader->Update();
> 
> typedef itk::Image<unsigned short, 3> ImageType;
> 
> typedef itk::VTKImageToImageFilter<ImageType> vtkType;
> 	vtkType::Pointer vtkToItk = vtkType::New();
> 		vtkToItk->SetInput(reader->GetOutput());
> 		vtkToItk->GetImporter()->Update();
> 
> 
> typedef itk::Image<float, 3> InternalImageType;
> 
> 	typedef itk::CastImageFilter<ImageType, InternalImageType>
> CastFilterType;
> 	CastFilterType::Pointer caster = CastFilterType::New();
> 		caster->SetInput(vtkToItk->GetOutput());
> 
> 	InternalImageType::Pointer input = caster->GetOutput();
> 
> itk::FastMarchingImageFilter<InternalImageType,
> InternalImageType>::Pointer marchingFilter
> 	=itk::FastMarchingImageFilter<InternalImageType,
> InternalImageType>::New();
> 		marchingFilter->SetInput(input);
> 		marchingFilter->SetStoppingValue(50);
> 		marchingFilter->SetSpeedConstant(1);
> 		marchingFilter->Update();
> 
> 
> ---------------
> dott. Giancarlo Amati
> Ph.D. Student
> University of Bologna - ITALY
> DIEM - Mechanical Department 
> job e-mail: giancarlo . amati at mail . ing . unibo . it
> personal email: gamati at libero . it
> web: http://diem101 . ing . unibo . it/personale/amati/
> ===========================================