[Insight-users] Inverted output from encapsulated OtsuThresholsFilter

Gaetan Lehmann gaetan.lehmann at jouy.inra.fr
Fri Jun 16 05:49:20 EDT 2006


Hi,

ITK's otsu filter gives an inverted output - it has been coded to set high  
values outside and low values inside (don't ask me why)

just do :

const OutputPixelType insideValue  = 0;
const OutputPixelType outsideValue = 1;
otsuFilter->SetInsideValue( insideValue );
otsuFilter->SetOutsideValue( outsideValue );

to fix the problem

Gaetan


On Fri, 16 Jun 2006 12:35:14 +0200, Martin Kavec <kavec at messi.uku.fi>  
wrote:

> Hi
>
> I am writing a sub-class of ImageToImageFilter to perform several  
> processing
> steps in a mini-pipeline. OtsuThresholdImageFilter is a part of it so I  
> have
> it encapsulated in the GenerateData() method (for the moment). The filter
> works in principle, but the output of Otsu filter is inverted eventhough  
> I
> SetInsideValue(1) and SetOusideValue(0). If I pass the same image through
> Examples/Filtering/OtsuThresholdImageFilter.cxx, the result is OK. The  
> input
> image is a 3D T1-weighted MRI volume with good SNR.
>
> I stripped down everything planned from the filter and left only the
> OtsuThresholdFilter in it, but the output image is still inverted: noise  
> = 1
> and object = 0. I am using ITK-2.6.0 and the result is the same on both  
> the
> gentoo linux and Mac OS 10.4.6 Intel.
>
> I placed the sourcecodes on a web for those interested:
>
> http://www.uku.fi/~kavec/mriRegionOfInterestGenerator.h
> http://www.uku.fi/~kavec/mriRegionOfInterestGenerator.txx
> http://www.uku.fi/~kavec/mriRegionOfInterestGeneratorTest.cxx
>
> I can not find a source of the problem and would appreciate any help.  
> Thanks,
>
> Martin
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr


More information about the Insight-users mailing list