[Insight-users] itkAnalyzeImageIO.cxx
R Holbrey
richardh at comp.leeds.ac.uk
Thu May 24 07:42:50 EDT 2007
Re: ReadImageInformation()
In a previous posting, remi.chapeaublanc at free.fr observed that s/he had
to comment out the line as:
std::vector<double> dirx = this->GetDirection(0),
diry = this->GetDirection(1),
dirz = this->GetDirection(2);
typedef itk::SpatialOrientationAdapter<3>::DirectionType
DirectionType;
DirectionType dir;
for(unsigned int i = 0; i < 3; i++)
{
dir[i][0] = dirx[i];
dir[i][1] = diry[i];
// dir[i][2] = dirz[i];
}
In ITK 3.2.0, I see this block is still hard-coded (but reversed) as (line
972):
unsigned dims = this->GetNumberOfDimensions();
std::vector<double> dirx(dims,0),
diry(dims,0),
dirz(dims,0);
dirx[0] = dir[0][0];
dirx[1] = dir[1][0];
dirx[2] = dir[2][0];
diry[0] = dir[0][1];
diry[1] = dir[1][1];
diry[2] = dir[2][1];
dirz[0] = dir[0][2];
dirz[1] = dir[1][2];
dirz[2] = dir[2][2];
for(unsigned i = 3; i < dims; i++)
...
which does not make much sense if dims==2 (as with some of our itk-snap
examples). Is dims>=3 being assumed and why?
As a simple fix, I suggest replacing the block above with:
unsigned dims = this->GetNumberOfDimensions();
std::vector<double> dirx(dims,0),
diry(dims,0),
dirz(dims,0);
for(unsigned i = 0; i < dims; i++) {
dirx[i] = dir[i][0];
diry[i] = dir[i][1];
dirz[i] = dir[i][2];
}
for(unsigned i = 3; i < dims; i++)
...
which seems to solve (one of) the problems we were having. Comments
appreciated,
Richard
More information about the Insight-users
mailing list