[Insight-users] All zero output with ResampleImageFilter (ITK 3.4)

Luis Ibanez luis.ibanez at kitware.com
Sat Dec 6 18:43:35 EST 2008


Hi Victor,


1) Thanks for detailing the code that you used.

    Your code is certainly a valid way of checking if all the
    pixels are zero.

    BTW: Instead of using these three for-loops you may find
         useful to learn to use the ITK Image iterator.

    The equivalent code would have been:

    ImageType::ConstPointer image = filResample->GetOutput()

    typedef itk::ImageRegionConstIterator< ImageType > Iterator;

    Iterator itr( image, image->GetBufferedRegion() );

    itr.GoToBegin();

    unsigned long pixelsOn = 0;

    while( itr.IsAtEnd() )
      {
      if( itr.Get() )
        {
        pixelsOn++;
        }
      ++itr;
      }

    You could have also used the class

             itkMinimumMaximumImageCalculator

    that you can find in Insight/Code/BasicFilters.



2) Thanks for trying setting the Similarity transform
    to identity.


3) Let's start from the beginning:

    Please post to the list the following information:

    a) Origin of the input image (input to the resample filter)
    b) Spacing of the input image   ""
    c) Number of pixels of the input image.

    You can get all this by doing:

       modReader->GetOutput()->Print( std::cout )

    Also, please post to the mailing list the following
    data:


          contActivo->Print( std::cout );


    We need to know as well, the pixel types of both images.



    By looking at these numbers we should be able to
    figure out what the problem is.




        Regards,



           Luis



------------------------------
Víctor Rodrigo Córdoba wrote:
> Hi.
> 
> 1) I use this piece of code:
> 
>     ImageType::SizeType 
> size1=filResample->GetOutput()->GetLargestPossibleRegion().GetSize();
>     ImageType::IndexType index;
>     index[0] = 0;index[1] = 0;index[2] = 0;
>     int pixelsOn=0;
>     for(index[2]=0;index[2]<size1[2];index[2]++) {
>         for(index[1]=0;index[1]<size1[1];index[1]++) {
>             for(index[0]=0;index[0]<size1[0];index[0]++) {
>                 if(filResample->GetOutput()->GetPixel(index)) {
>                     pixelsOn++;
>                 }
>             }
>         }
>     }
> 
>   After executing this, pixelsOn is zero.
>   Does it exist any program to check pixel values?
> 
>  2) I set Similarity Transform to be an identity, commenting:
> 
>     //transform->SetScale(scale);
>     //transform->SetTranslation(translation);
> 
>  but nothing changes.
> 
> Thank you for responding.
> 
> 2008/12/2 Luis Ibanez <luis.ibanez at kitware.com 
> <mailto:luis.ibanez at kitware.com>>
> 
> 
> 
>     Hi Victor,
> 
> 
>     1) How did you arrive to the conclusion
>       that all the output values are zeros ?
> 
>       because you see a black image in a visualization tool ?
>       or because you actually used a program to check the
>       pixel values ?
> 
>     2) If you set the Similarty Transform to be an Identity,
>       do you see an proper image in the output ?
> 
> 
>     Please let us know,
> 
> 
> 
>       Thanks
> 
> 
>           Luis
> 
> 


More information about the Insight-users mailing list