<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18854"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=043402715-22122009><FONT color=#0000ff
size=2 face=Arial>Hmm, sorry, i thougt the base class is the itk::Transform
class which always returns false. I did not see that the base class is
MatrixOffsetTransformBase. My fault!</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=043402715-22122009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=043402715-22122009><FONT color=#0000ff
size=2 face=Arial>Thanks for answer!</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=043402715-22122009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=043402715-22122009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV><BR>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> Wes Turner [mailto:wes.turner@kitware.com]
<BR><B>Gesendet:</B> Dienstag, 22. Dezember 2009 16:17<BR><B>An:</B> Lodron,
Gerald<BR><B>Cc:</B> insight-users@itk.org<BR><B>Betreff:</B> Re:
[Insight-users] Inverse of affine not inplemented<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>I took a (very) quick look. If it is returning NULL then it appears
that either your matrix is singular, or you are not calling it correctly.
BTW: bool GetInverse(transform) expects the transform to be passed in and
only returns true or false depending on if the matrix inversion was successful
or not. YOu probably want to make a call to
transform->GetInverseMatrix() instead.</DIV>
<DIV><BR></DIV>
<DIV>Code is included below.</DIV>
<DIV><BR></DIV>
<DIV>- Wes</DIV>
<DIV><BR></DIV>
<DIV>// Recompute the inverse matrix (internal)</DIV>
<DIV>template<class TScalarType, unsigned int NInputDimensions,</DIV>
<DIV>
unsigned int NOutputDimensions></DIV>
<DIV>const typename MatrixOffsetTransformBase<TScalarType,</DIV>
<DIV>
NInputDimensions,</DIV>
<DIV>
NOutputDimensions>::InverseMatrixType
&</DIV>
<DIV>MatrixOffsetTransformBase<TScalarType, NInputDimensions,
NOutputDimensions></DIV>
<DIV>::GetInverseMatrix( void ) const</DIV>
<DIV>{</DIV>
<DIV> // If the transform has been modified we recompute the
inverse</DIV>
<DIV> if(m_InverseMatrixMTime != m_MatrixMTime)</DIV>
<DIV> {</DIV>
<DIV> m_Singular = false;</DIV>
<DIV> try </DIV>
<DIV> {</DIV>
<DIV> m_InverseMatrix =
m_Matrix.GetInverse();</DIV>
<DIV> }</DIV>
<DIV> catch(...) </DIV>
<DIV> {</DIV>
<DIV> m_Singular = true;</DIV>
<DIV> }</DIV>
<DIV> m_InverseMatrixMTime = m_MatrixMTime;</DIV>
<DIV> }</DIV>
<DIV><BR></DIV>
<DIV> return m_InverseMatrix;</DIV>
<DIV>}</DIV>
<DIV><BR></DIV>
<DIV>// return an inverse transformation</DIV>
<DIV>template<class TScalarType, unsigned int NInputDimensions,</DIV>
<DIV>
unsigned int NOutputDimensions></DIV>
<DIV>bool</DIV>
<DIV>MatrixOffsetTransformBase<TScalarType, NInputDimensions,
NOutputDimensions></DIV>
<DIV>::GetInverse( Self * inverse) const</DIV>
<DIV>{</DIV>
<DIV> if(!inverse)</DIV>
<DIV> {</DIV>
<DIV> return false;</DIV>
<DIV> }</DIV>
<DIV><BR></DIV>
<DIV> this->GetInverseMatrix();</DIV>
<DIV> if(m_Singular)</DIV>
<DIV> {</DIV>
<DIV> return false;</DIV>
<DIV> }</DIV>
<DIV><BR></DIV>
<DIV> inverse->m_Matrix =
this->GetInverseMatrix();</DIV>
<DIV> inverse->m_InverseMatrix = m_Matrix;</DIV>
<DIV> inverse->m_Offset =
-(this->GetInverseMatrix() * m_Offset);</DIV>
<DIV> inverse->ComputeTranslation();</DIV>
<DIV> inverse->ComputeMatrixParameters();</DIV>
<DIV><BR></DIV>
<DIV> return true;</DIV>
<DIV>}</DIV>
<DIV><BR></DIV><BR>
<DIV class=gmail_quote>On Tue, Dec 22, 2009 at 10:04 AM, Lodron, Gerald <SPAN
dir=ltr><<A
href="mailto:Gerald.Lodron@joanneum.at">Gerald.Lodron@joanneum.at</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>
<DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN>The method
is there but it always returns NULL. I looked in the code it really always
returns NULL but i think in most ways the affine should be invertable so the
code in the function should be changed</SPAN></FONT></DIV><BR>
<DIV dir=ltr lang=de align=left>
<HR>
<FONT size=2 face=Tahoma><B>Von:</B> Wes Turner [mailto:<A
href="mailto:wes.turner@kitware.com" target=_blank>wes.turner@kitware.com</A>]
<BR><B>Gesendet:</B> Dienstag, 22. Dezember 2009 16:02<BR><B>An:</B> Lodron,
Gerald<BR><B>Cc:</B> <A href="mailto:insight-users@itk.org"
target=_blank>insight-users@itk.org</A><BR><B>Betreff:</B> Re: [Insight-users]
Inverse of affine not inplemented<BR></FONT><BR></DIV>
<DIV>
<DIV></DIV>
<DIV class=h5>
<DIV></DIV>
<DIV>There appears to be a GetInverse() method for the Affine Transform.
Can you give a better description of your problem.</DIV>
<DIV><BR></DIV>
<DIV>- Wes</DIV>
<DIV><BR></DIV><A
href="http://www.itk.org/Doxygen316/html/classitk_1_1AffineTransform.html#d294a8a59b93d3663de46705490a189e"
target=_blank>http://www.itk.org/Doxygen316/html/classitk_1_1AffineTransform.html#d294a8a59b93d3663de46705490a189e</A><BR><BR>
<DIV class=gmail_quote>On Tue, Dec 22, 2009 at 8:10 AM, Lodron, Gerald <SPAN
dir=ltr><<A href="mailto:Gerald.Lodron@joanneum.at"
target=_blank>Gerald.Lodron@joanneum.at</A>></SPAN> wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>Hello<BR><BR>Is there a reason for the missing
GetInverse() implementation of the affine transformation or is it a missing
issue?<BR><BR>Best
regards<BR><BR>_____________________________________<BR>Powered by <A
href="http://www.kitware.com" target=_blank>www.kitware.com</A><BR><BR>Visit
other Kitware open-source projects at<BR><A
href="http://www.kitware.com/opensource/opensource.html"
target=_blank>http://www.kitware.com/opensource/opensource.html</A><BR><BR>Kitware
offers ITK Training Courses, for more information visit:<BR><A
href="http://www.kitware.com/products/protraining.html"
target=_blank>http://www.kitware.com/products/protraining.html</A><BR><BR>Please
keep messages on-topic and check the ITK FAQ at:<BR><A
href="http://www.itk.org/Wiki/ITK_FAQ"
target=_blank>http://www.itk.org/Wiki/ITK_FAQ</A><BR><BR>Follow this link to
subscribe/unsubscribe:<BR><A
href="http://www.itk.org/mailman/listinfo/insight-users"
target=_blank>http://www.itk.org/mailman/listinfo/insight-users</A><BR></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>Wesley D. Turner, Ph.D.<BR>Kitware, Inc.<BR>Technical
Leader<BR>28 Corporate Drive<BR>Clifton Park, NY 12065-8662<BR>Phone:
518-881-4920<BR></DIV></DIV></DIV></BLOCKQUOTE></DIV><BR><BR clear=all><BR>--
<BR>Wesley D. Turner, Ph.D.<BR>Kitware, Inc.<BR>Technical Leader<BR>28 Corporate
Drive<BR>Clifton Park, NY 12065-8662<BR>Phone: 518-881-4920<BR></BODY></HTML>