[Insight-users] itkNormalizeImageFilter and itkSigmoid filter ????

Bill Lorensen bill.lorensen at gmail.com
Mon Oct 20 10:45:33 EDT 2008


Robert,

Since this filter will normalize the data to be within -1,1 the output
should be a non-integral type like float or double. This is mentioned
in the documentation for the filter. Since your data type was unsigned
short, the computation resulted in values of wither 0 or 1.

We should probably add a ConceptCheck for a non-integral type.

Bill

That said, you will have to save the result in a file format that
supports float or double (e.g. meta or nrrd).

Bill

On Mon, Oct 20, 2008 at 10:26 AM, robertsen p <itkseeker at gmail.com> wrote:
> Hi Bill
>
> Thanks for prompt reply. Here is my code...Since I am newbie in ITK. I
> really dont get how to set parameters for itkNormalizeImageFilter.h .
>
> Any ways here is my code
>
> #if defined(_MSC_VER)
> #pragma warning ( disable : 4786 )
> #endif
> #include "itkImageFileReader.h"
> #include "itkImageFileWriter.h"
> #include "itkImage.h"
> #include "itkNormalizeImageFilter.h"
>
> int main( int argc, char *argv[] )
> {
>   const    unsigned int    ImageDimension = 2;
>   typedef  unsigned short           PixelType;
>
>   typedef itk::Image< PixelType, ImageDimension >  FixedImageType;
>   typedef itk::ImageFileReader< FixedImageType  > FixedImageReaderType;
>   FixedImageReaderType::Pointer  fixedImageReader  =
> FixedImageReaderType::New();
>   fixedImageReader->SetFileName(  "Source.png" );
>   typedef unsigned short  InternalPixelType;
>   typedef itk::Image <InternalPixelType,ImageDimension> InternalImageType;
>   typedef
> itk::NormalizeImageFilter<FixedImageType,InternalImageType>fixedNormalizeFilterType;
>
>   fixedNormalizeFilterType::Pointer  normlizer =
> fixedNormalizeFilterType::New();
>
>   normlizer->SetInput(fixedImageReader->GetOutput());
>
>   typedef itk::ImageFileWriter< InternalImageType >  WriterType;
>   WriterType::Pointer  writer =  WriterType::New();
>   writer->SetFileName( "NormalizedImage_OP.png");
>   writer->SetInput(normlizer->GetOutput());
>
>  try
>     {
>     writer->Update();
>     }
>   catch( itk::ExceptionObject & err )
>     {
>     std::cerr << "ExceptionObject caught !" << std::endl;
>     std::cerr << err << std::endl;
>     return -1;
>     }
>   return 0;
> }
>
>
> On Mon, Oct 20, 2008 at 4:20 PM, Bill Lorensen <bill.lorensen at gmail.com>
> wrote:
>>
>> itkNormalizeImageFilter should do the job. Can you post your code?
>>
>> On Mon, Oct 20, 2008 at 10:15 AM, robertsen p <itkseeker at gmail.com> wrote:
>> > Dear All
>> >
>> > I want to normalize images into zero mean and unit variance for
>> > intensity
>> > based Image registration. I have tried itkNormalizeImageFilter.h
>> > but It doesnt give a desired output (Image looks binary). Why???
>> >
>> > I tried with sigmoid filter but how to set values of alpha and beta so
>> > as to
>> > get unit variance and zero mean ....still output image to be gray
>> > scale??
>> >
>> > Please help . looking forward to receive your reply.
>> >
>> > Regards
>> > Robert/
>> >
>> >
>> > _______________________________________________
>> > Insight-users mailing list
>> > Insight-users at itk.org
>> > http://www.itk.org/mailman/listinfo/insight-users
>> >
>> >
>
>


More information about the Insight-users mailing list