[Insight-users] MultiResolutionImageFilter question again

Luis Ibanez luis . ibanez at kitware . com
Thu, 20 Nov 2003 11:44:18 -0500


Hi Fucang,

Your coarser levels in the pyramid are too small.

You are asking to create a top image of 2x2 pixels !!!
There is not much to see in such an small image  :-)

Even 16x16 is probably irrelevant.

The reason why the filter will produce buggy images
at such small sizes is that for subsampling correctly
it first smooths the image with a RecursiveGaussian
filter.

As you may know from signal processing, it is fundamental
to apply smoothing previous to subsampling in order to
avoid the aliasing effect that would result from
overlapping spectra in the frequency domain.

The Recursive Gaussian filter users an IIR filter in
order to approximate the effect of convolving with
a Gaussian. This IIR filter is of order 4 (that is, it
uses 4 pixels at a time) and does two passes, one in the
causal direction and the other in the anticausal direction.
This comes down to say that the smallest image that you can
process with this filter must have 8 pixels along each
dimension.

In any case, even if the filter could go lower, there is
not much you can do for registering two images of 8x8 pixels.
You are probably ok by using 32x32 as the top level of
the pyramid.


Regards,


   Luis


---------------------------
Fucang Jia wrote:
> Hi, Lydia,
> 
> Thank you very much!
> 
> As you said, this is due to the pixel type. Here is another question:
> My input image type is 512x512 unsigned short. I set the number of
> multiresolution to 8, and the levels be
> [256, 256] -> first
> [128, 128] -> second
> [64, 64]    -> third
> [32, 32]    -> fourth
> [16, 16]    -> fifth
> [8, 8]       -> sixth
> [4, 4]       -> seventh
> [2, 2]       -> eighth
> 
> the first to the fifth level is right now. But the sixth to eighth level 
> images are not
> right yet. The ImageViewer application tells that
> Int.Range:nan0x7fffffff - nan0x7fffffff
> Int.Window: nan0x7fffffff(Min) - nan0x7fffffff(Max).
> 
> I think the multiresolution image filter can only downsample to 8x8 at 
> larget for a 2d image, is that right?
> 
> Thank you!
> 
> Fucang
> 
> 
>> From: "Lydia Ng" <lng at insightful . com>
>> To: "Fucang Jia" <jiafucang at hotmail . com>, <insight-users at itk . org>
>> Subject: RE: [Insight-users] Why MultiResolutionPyramidImageFilter 
>> does not produce right image?
>> Date: Wed, 19 Nov 2003 09:25:54 -0800
>>
>> Hi Fucang,
>>
>> I think the filter requires the output pixel type to be floating 
>> point. Could
>> you try it out as an experiment?
>>
>> - Lydia
>>
>> > -----Original Message-----
>> > From: Fucang Jia [mailto:jiafucang at hotmail . com]
>> > Sent: Wednesday, November 19, 2003 1:17 AM
>> > To: insight-users at itk . org
>> > Subject: [Insight-users] Why MultiResolutionPyramidImageFilter does not
>> > produce right image?
>> >
>> > Hi, everyone,
>> >
>> > I am using ITK 1.4 and want to do some experiments based on
>> > MultiResolutionPyramid. But the following program does not give correct
>> > images. It does produce 8 images, but the first level image is all 
>> zeros.
>> > So
>> > the error spreads to the next level images. Is there some error in this
>> > program?
>> >
>> > Thanks a lot!
>> >
>> > Fucang
>> >
>> >
>> > =============================
>> > int main(int argc, char *argv[] )
>> > {
>> >
>> >
>> >   if(argc<2)
>> >   {
>> >    std::cerr<<argv[0]<<" Input2DImage"<<std::endl;
>> >    return -1;
>> >   }
>> >
>> >   typedef unsigned short PixelType;
>> >   const unsigned short Dimension = 2;
>> >
>> >   typedef itk::Image<PixelType,Dimension>       InputImageType;
>> >   typedef itk::Image<PixelType,Dimension>       OutputImageType;
>> >   typedef itk::ImageFileReader<InputImageType>  ReaderType;
>> >   typedef itk::ImageFileWriter<OutputImageType> WriterType;
>> >   typedef
>> > itk::MultiResolutionPyramidImageFilter<InputImageType,OutputImageType>
>> >     PyramidType;
>> >   ReaderType::Pointer  reader  = ReaderType::New();
>> >   WriterType::Pointer  writer  = WriterType::New();
>> >   PyramidType::Pointer pyramid = PyramidType::New();
>> >
>> >
>> >   reader->SetFileName(argv[1]);
>> >   reader->Update();
>> >
>> >   pyramid->SetInput( reader->GetOutput() );
>> >
>> >   unsigned int numLevels;
>> >   itk::Vector<unsigned int,Dimension> factors;
>> >
>> >   numLevels = 8;
>> >   factors[0] = 256; factors[1] = 256;
>> >
>> >   pyramid->SetNumberOfLevels( numLevels );
>> >   pyramid->SetStartingShrinkFactors( 256 );
>> >   pyramid->Print( std::cout );
>> >
>> >   pyramid->Update();
>> >
>> >   for (int i=0;i<numLevels;i++)
>> >   {
>> >    char str[4096];
>> >    sprintf(str,"test_%d.png",i);
>> >    writer->SetFileName(str);
>> >    writer->SetInput(pyramid->GetOutput(i));
>> >    writer->Update();
>> >   }
>> >
>> >   return 0;
>> > }
>> >
>> > _________________________________________________________________
>> > The new MSN 8: advanced junk mail protection and 2 months FREE*
>> > http://join . msn . com/?pagežatures/junkmail
>> >
>> > _______________________________________________
>> > Insight-users mailing list
>> > Insight-users at itk . org
>> > http://www . itk . org/mailman/listinfo/insight-users
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk . org
>> http://www . itk . org/mailman/listinfo/insight-users
> 
> 
> _________________________________________________________________
> The new MSN 8: smart spam protection and 2 months FREE*  
> http://join . msn . com/?page=features/junkmail
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>