[Insight-users] RecursiveMultiResolutionPyramidImageFilter

Corinne Mattmann mattmaco at ee.ethz.ch
Sun, 15 Feb 2004 22:28:17 +0100


Hi,

I use the RecursiveMultiResolutionPyramidImageFilter and I noticed that I
get slightly different image values when I have the same subsampling factor
but at another level of the pyramid. In the attached code and output, the
difference can be seen: I produce 2 pyramids, one with 1 level and
StartingShrinkFactors 4, the other one has three levels and the same
factors. I compare then the output images of the two pyramids at the first
level (0). They both have the same size, but the values are slightly
different, e.g. 46.6713 and 48.9142 (I have char-images with values between
0 and 127).
Has this something to do with the fact that the smaller image size (12) is
not exactly a factor of 4 smaller than the original one (50)?

Thanks,
Corinne


------------------------ code -------------------------

    typedef Image<char, 3> ImageType;
    typedef Image<float, 3> InternalImageType;
    typedef
RecursiveMultiResolutionPyramidImageFilter<InputImageType,InternalImageType>
FixedPyramidType;
    typename FixedPyramidType::Pointer   TestPyramid1;
      TestPyramid1 = FixedPyramidType::New();
      TestPyramid1->SetInput(inputPtr1);
      TestPyramid1->SetNumberOfLevels(3);
      TestPyramid1->SetStartingShrinkFactors(4);
      TestPyramid1->GetOutput(0)->Update();
    typename FixedPyramidType::Pointer   TestPyramid2;
      TestPyramid2 = FixedPyramidType::New();
      TestPyramid2->SetInput(inputPtr1);
      TestPyramid2->SetNumberOfLevels(1);
      TestPyramid2->SetStartingShrinkFactors(4);
      TestPyramid2->GetOutput(0)->Update();
    TOutputImage::IndexType index;
      index[0] = 5;
      index[1] = 5;
      index[2] = 5;
      std::cout << "Pixel value pyramid 1: " <<
TestPyramid1->GetOutput(0)->GetPixel(index) << std::endl;
      std::cout << "Region pyramid 1: " <<
TestPyramid1->GetOutput(0)->GetLargestPossibleRegion() << std::endl;
      std::cout << "Spacing pyramid 1: " <<
TestPyramid1->GetOutput(0)->GetSpacing() << std::endl;
      std::cout << "Origin pyramid 1: " <<
TestPyramid1->GetOutput(0)->GetOrigin() << std::endl;
      std::cout << "Pixel value pyramid 2: " <<
TestPyramid2->GetOutput(0)->GetPixel(index) << std::endl;
      std::cout << "Region pyramid 2: " <<
TestPyramid2->GetOutput(0)->GetLargestPossibleRegion() << std::endl;
      std::cout << "Spacing pyramid 2: " <<
TestPyramid2->GetOutput(0)->GetSpacing() << std::endl;
      std::cout << "Origin pyramid 2: " <<
TestPyramid2->GetOutput(0)->GetOrigin() << std::endl;


------------------------ output -------------------------

Pixel value pyramid 1: 46.6713
Region pyramid 1: ImageRegion (0223DEC8)
			  Dimension: 3
			  Index: [0, 0, 0]
			  Size: [12, 12, 12]
Spacing pyramid 1: 0.136  0.136  0.136
Origin pyramid 1: 8.466  8.398  3.468

Pixel value pyramid 2: 48.9142
Region pyramid 2: ImageRegion (0223D8B8)
			  Dimension: 3
			  Index: [0, 0, 0]
			  Size: [12, 12, 12]
Spacing pyramid 2: 0.136  0.136  0.136
Origin pyramid 2: 8.466  8.398  3.468