<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>I'm implementing a filter that take 4 4D images as input and produce a 3D image as output. While executing I get the following exception:</div><div><br></div><div> terminate called after throwing an instance of 'itk::ExceptionObject'<br> what(): /usr/local/ITK-4.2/include/ITK-4.2/itkImageBase.hxx:336:<br>itk::ERROR: Image(0x993f480): itk::ImageBase::CopyInformation() cannot cast PKN3itk10DataObjectE to PKN3itk9ImageBaseILj3EEE<br>Aborted<br></div><div><br></div><div>this is the declaration of the class</div><div><br></div><div>typedef float PCPixelType;<br>typedef Image< PCPixelType, 4 > PhaseContrastImage;<br>typedef Image< PCPixelType, 3 > PhaseContrast3DImage;<br><br></div><div><br></div><div>class PhaseContrastTimeAveragedImageFilter : public ImageToImageFilter< PhaseContrastImage,
PhaseContrast3DImage ><br>{<br>public:<br> /** Standard class typedefs. */<br> typedef PhaseContrastTimeAveragedImageFilter Self;<br> typedef ImageToImageFilter< PhaseContrastImage, PhaseContrast3DImage > Superclass;<br> typedef SmartPointer< Self > Pointer;<br> /** Method for creation through the object factory. */<br> itkNewMacro(Self);<br> <br> /** Run-time type information (and related methods). */<br> itkTypeMacro(PhaseContrastTimeAveragedImageFilter, ImageToImageFilter);<br> <br> /** The 4D magnitude image.*/<br> void SetMagnitudeImage(const PhaseContrastImage* image);<br> <br> /** The 4D X component of the phase image.*/<br> void SetPhaseXImage(const PhaseContrastImage* image);<br><br> /** The 4D Y component of the phase
image.*/<br> void SetPhaseYImage(const PhaseContrastImage* image);<br><br> /** The 4D Z component of the phase image.*/<br> void SetPhaseZImage(const PhaseContrastImage* image);<br><br> <br> itkGetConstMacro(NoiseMaskThreshold, float);<br> void SetNoiseMaskThreshold( float threshold );<br> <br>protected:<br> PhaseContrastTimeAveragedImageFilter()</div><div> {<br> this->SetNumberOfRequiredInputs(4);<br> this->m_NoiseMaskThreshold = 0.1;<br> this->m_NoiseMaskThresholdValue = 0.0;<br> this->m_MaximumMagnitude = 0.0;<br> this->m_MinimumMagnitude = 0.0;<br> }<br></div><div> ~PhaseContrastTimeAveragedImageFilter() {}<br><br> virtual void BeforeThreadedGenerateData();<br> <br> /** Does the real work. */<br> virtual void ThreadedGenerateData(const
Superclass::OutputImageRegionType& outputRegionForThread, int threadId);<br> <br>private:<br> PhaseContrastTimeAveragedImageFilter(const Self &); //purposely not implemented<br> void operator=(const Self &); //purposely not implemented<br><br> float m_NoiseMaskThreshold;<br> float m_NoiseMaskThresholdValue;<br> float m_MaximumMagnitude;<br> float m_MinimumMagnitude;<br>};<br></div><div><br></div><div>Any suggestion of how to find out or where to look for in order to solve the problem raised by the exception?</div><div><br></div><div>best regards,</div><div><br></div><div><br></div></div></body></html>