Beispiel #1
0
template <unsigned dim,typename T> void
itkPhilipsRECDataImageReader::applyCorrection(FloatImageType::PointType correctorigin,
                                              FloatImageType::DirectionType correctdirection)
{
    // To take care of dimensions 3 and 4,
    // we need new direction and point types.
    typedef itk::Image<T,dim> ImageType;
    typedef typename ImageType::DirectionType correctDirectionType;
    typedef typename ImageType::PointType correctPointType;


    correctDirectionType direction;
    direction.SetIdentity();
    for (unsigned int i=0; i<3; i++)
        for (unsigned int j=0; j<3; j++)
            direction[i][j] = correctdirection[i][j];
    correctPointType origin;
    origin.Fill(0.0);
    for (unsigned int i=0; i<3; i++)
        origin[i] = correctorigin[i];

    ImageType* img = (ImageType *) (data()->data());
    img->SetDirection(direction);
    img->SetOrigin(origin);
}