[Insight-users] problems with median filter
Luis Ibanez
luis . ibanez at kitware . com
Tue, 15 Jul 2003 15:37:32 -0400
Hi Carolyn,
The Median filter shouldn't produce any wrapping
around the boundaries. Specially not that big
(500 pixels).
One possiblity is that the mechanism you are using
for importing the data into an ITK image is not
consistent.
The main suspects here are the regions:
LargestPossibleRegion
BufferedRegion
RequestedRegion
Could you please do the following test:
Add a Print( std::cout ) statement to the input image
of the Median filter (before you run the filter), and
also add a Print() on the output image of the median
filter.
Something like
importedImage->Print( std::cout );
medianFilter->SetInput( importedImage );
medianFilter->Update();
medianFilter->GetOutput()->Print( std::cout );
and please post to the list the results of both
Print() statements. What we want to check for
is the correspondance between the regions in the
input image and the regions of the output image.
A typical source of error may be that one of the
image regions has a starting index different from
zero.
Please let us know what you find.
You are also welcome to post the conversion code
that you are using for creating the ITK image from
your elevation data.
Thanks
Luis
-------------------------
Carolyn Johnston wrote:
> Hello all,
>
> I am using ITK to run some experiments with registration of digital
> elevation models. I have run into a confusing problem using the median
> filter class.
>
> I read in a digital elevation model and convert it to an itk float image
> using a conversion class. I set the image region, the origin, and the
> spacing for the image. I then write the resulting image out in raw
> format, and confirm that it is identical to what I read in.
>
> I then filter the image, and again write the raw output. I have tested
> the gradient magnitude filter, the threshold filter, and the median
> filter. Median filtering seems to introduce a sizeable deterministic
> shift into the output: the other filters I have tried don't do this. The
> shift is on the order of 500 pixels in Y and around 10 or so in X (for a
> 3600 by 3600 image). Rows and columns of zeros are introduced as well --
> around 15 columns of zeros and 5 rows of zeros at the boundaries of the
> original image. Other than that, the image wraps at the boundaries.
>
> I suspect there is some parameter I am not setting, or am not setting
> correctly. I stepped through the median filtering code with gdb but did
> not find an uninitialized or default parameter read. What might be
> causing this problem?
>
> thanks,
> Carolyn Johnston
> Sr. Engineer, Vexcel Corporation
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>