[Insight-developers] ItkImage check for non-orthogonal direction matrix breaks itkExtractImageFilter

Bill Lorensen bill.lorensen at gmail.com
Thu Oct 23 15:48:38 EDT 2008


It seems the best we can do is create an identity matrix. We should be
able to find those filters that might present a problem and buy a
try/catch around the SetDirection call., There are not that many
filters that reduce the dimension.

Kent, file a bug and assign it to me.

Bill

On Tue, Oct 21, 2008 at 12:30 PM, kent williams
<norman-k-williams at uiowa.edu> wrote:
>
> So if I take an image whose direction cosines are:
>    {{1, 0, 0}, {0, 0, -1}, {0, -1, 0}}
> And I try to use the itk::ExtractImageFilter to extract this region from it:
> {
>  m_Index = { m_Index = {0, 0, 3} },
>  m_Size = { m_Size = {5, 5, 0} }
> }
>
> It throws an exception, because it tries to set these 2D direction cosines
> on the output image
>
> {{1, 0},{0,0}}
>
> This is the exception thrown:
>
> itk::ExceptionObject (0x76cff0)
> Location: "void itk::Image<TPixel, VImageDimension>::SetDirection(typename
> itk::ImageBase<VImageDimension>::DirectionType) [with TPixel = unsigned
> char, unsigned int VImageDimension = 2u]"
> File:
> /scratch/kent/brains2/MACOSX/DEBUG/src/include/InsightToolkit/Common/itkImag
> e.h
> Line: 364
> Description: itk::ERROR: Image(0x76eb50): Bad direction, determinant is 0.
> Direction is 1 0
> 0 0
>
> I can patch the ExtractImageFilter to do something to satisfy the test for
> orthogonal directions in itk::Image::SetDirection, as I did the places in
> the Insight/Code/IO tests and Insight/Code/IO already.
>
> But the question is this: where does it end?  Do we patch every place that
> sets 2D direction cosines from the 3Dimensional direction cosines?
>
> And by patch I mean what I did other places -- fake up nonsense 2D dir
> cosines so that their determinant is non-zero.
>
> Before the test of the determinant of the dir cosines was added, a lot of
> code was written and apparently passed regression. This was the case by
> accident in ITK -- the old tests created images without ever setting the dir
> cosines, which left them at identity, and the identity dir cosines are by
> happenstance {{1,0,0},{0,1,0},{0,0,1}}.  The identity dir cosines have an
> advantage in that lopping off a dimension still left valid 2D Direction
> Cosines.
>
>
>
> ------ End of Forwarded Message
>
>
>
> Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list