[Insight-users] AddImageFilter problem...

Joshua Cates cates at sci.utah.edu
Tue, 17 Feb 2004 11:34:36 -0700 (MST)


Hi Sergio,

It will help if you let us know what error
you are getting. 

I would suggest enclosing your Update() 
calls in try/catch blocks.  You can print
any exceptions that ITK throws.

For example,

try {
myFilter->Update();
}
catch (itk::ExceptionObject &e)
{
std::cerr << e << std::endl;
return ERROR_CODE;
}

Josh.

______________________________
 Josh Cates			
 Scientific Computing and Imaging Institute
 University of Utah
 Email: cates at sci.utah.edu
 Phone: (801) 587-7697
 URL:   http://www.sci.utah.edu/~cates


On Tue, 17 Feb 2004, Sergio Andres wrote:

> 
> Hi all,
> 
> I have a problem with itk::AddImageFilter.
> When Update() is called I get an error.
> 
> My code is like this:
> 
> ...   
>     // typedefs
>     typedef uzImage<unsigned char, 2> UCharImageType;
>     typedef uzImage<double, 2> DoubleImageType;
> 
>     typedef uzImageWriter<UCharImageType> UCharImageWriterType;
> 
>     typedef itk::RescaleIntensityImageFilter<DoubleImageType, 
> UCharImageType> RescaleFilter;
>     typedef itk::AddImageFilter<DoubleImageType, DoubleImageType, 
> DoubleImageType> AddImageFilterType;
> 
>     // writer
>     UCharImageWriterType::Pointer imageWriter = UCharImageWriterType::New();
> 
>     // rescale filter
>     RescaleFilter::Pointer rescaleFilter = RescaleFilter::New();
>     rescaleFilter->SetOutputMaximum(255);
>     rescaleFilter->SetOutputMinimum(0);
> 
>     // add filter
>     AddImageFilterType::Pointer addFilter = AddImageFilterType::New();
> 
>     addFilter->SetInput1(outputImages[0]);
>     addFilter->SetInput1(outputImages[1]);
>     addFilter->Update();    // this produces an error....***
> 
>     DoubleImageType::Pointer outputImage;
>     outputImage = addFilter->GetOutput();
> 
>     rescaleFilter->SetInput(outputImage.GetPointer());
> 
>     imageWriter->SetFileName(fileName);
>     imageWriter->SetInput(rescaleFilter->GetOutput());
>     imageWriter->Update();
> ...
> 
> I will appreciate any suggestion ...
> 
> Thanks in advance,
> 
> Sergio.
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>