[Insight-developers] Initialization question

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Feb 26 10:57:29 EST 2009


I wonder if this is releated to the failing registration tests on  
mini1. I am going to blindly fire off an experimental on mini1 with  
these changes to see what happens.

Brad

On Feb 26, 2009, at 9:38 AM, Hans Johnson wrote:

> I was reviewing the code in itkImageBase and I think I found a  
> possible
> un-initialized memory location.
>
> Should line 176 be change to:
> scale.Fill(0.0);
> In order to ensure that the matrix is has zeros on the off diagonal
> locations?  Or is it guaranteed that the constructor for itkMarix  
> will zero
> out all the memory locations?
>
> If the constructor does zero out the memory, then a comment to that  
> effect
> would be nice.  This just did not look correct since in most places  
> when
> declaring a multi-element entity where only some of the elements are
> touched, it is common to have the myvar.Fill(0.0) immediately after  
> the
> declaration.
>
>
> Hans
>
> 169
> //--------------------------------------------------------------------------
> --
> 170 template<unsigned int VImageDimension>
> 171 void
> 172 ImageBase<VImageDimension>
> 173 ::ComputeIndexToPhysicalPointMatrices()
> 174 {
> 175   DirectionType scale;
> 176
> 177   for (unsigned int i=0; i < VImageDimension; i++)
> 178     {
> 179     if (this->m_Spacing[i] == 0.0)
> 180       {
> 181       itkExceptionMacro("A spacing of 0 is not allowed: Spacing  
> is " <<
> this->m_Spacing);
> 182       }
> 183     scale[i][i] = this->m_Spacing[i];
> 184     }
> 185
> 186   if (vnl_determinant(this->m_Direction.GetVnlMatrix()) == 0.0)
> 187     {
> 188     itkExceptionMacro(<< "Bad direction, determinant is 0.  
> Direction is
> " << this->m_Direction);
> 189     }
> 190
> 191   this->m_IndexToPhysicalPoint = this->m_Direction * scale;
> 192   this->m_PhysicalPointToIndex =  
> m_IndexToPhysicalPoint.GetInverse();
> 193
> 194   this->Modified();
> 195 }
>
> -- 
> Hans J. Johnson, Ph.D.
> Hans-johnson at uiowa.edu
>
> 278 GH
> The University of Iowa
> Iowa City, IA 52241
> (319) 353 8587
>
>
>
> 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.
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers



More information about the Insight-developers mailing list