[Insight-developers] ImageIOBase::SetDirection

Mathieu Malaterre mathieu.malaterre at kitware.com
Wed Mar 8 12:54:25 EST 2006


Ok, never send a mail just before going to lunch...

I still have some initialized memory read, but this is not due to the 
size of m_Direction.

Does ITK Direction cosines uses a dim x dim matrix ?

Thanks,
Mathieu

Mathieu Malaterre wrote:
> Hello,
> 
>     I am looking at function like
> ImageIOBase::SetDirection
> and
> ImageIOBase::SetNumberOfDimensions(unsigned int dim)
> 
>     Could someone correct me, but I thought m_Direction was the 
> direction cosine, right ? If so I don't believe the code is working 
> since we need at least 2*image dimension (we assume orthogonal base to 
> compute direction of 3d component) for the size
> 
> 
> void ImageIOBase::SetNumberOfDimensions(unsigned int dim)
> {
>   if(dim != m_NumberOfDimensions)
>     {
>     ...
>     m_Direction.resize( dim * 2);
>                             ^^^^
> 
> 
> and incidentally the SetDirection code should look like:
> 
>   if (i > m_Direction.size() ) {return;} // wrong precondition
>   this->Modified();
>   std::vector<double> v;
>   v.resize(direction.size());
>            ^^^^^^^^^
>   for (unsigned int j=0; j < v.size(); j++)
>     {
>     v[j] = direction[j];
>     }
>   m_Direction[i] = v;
> 
> 
> Comments welcome ?
> Mathieu
> _______________________________________________
> 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