[Insight-users] Using itkRayCastInterpolateImageFunction to evaluate one pixel value

Moti Freiman freiman at cs.huji.ac.il
Thu Jun 8 02:54:22 EDT 2006


Hello all,

I'm trying to build a filter that will be able to evaluate the value of 
one pixel in a 2d image as a result

of a raycast image function over a given volume.

When I compare my result (the whole image sampled pixel after pixel) to 
the result of the example:

Digitally Reconstructed Radiograph, which given in the examples folder 
of the ITK 2.6 distribution, I have very few pixels that have different 
values.

The Digitally Reconstructed Radiograph example use the 
itkResampleImageFilter to build its output image, and this filter scan 
lines in the output image and reconstruct them, instead of evaluate each 
pixel separately.

I add part of my code (after building the coordinates system of the 
original volume and the output image, which seems to works well).


Maybe anyone wrote such a filter, or can find where is the difference 
between my code and the resample image filter.

Many thanks,

Moti


************** code ************************

View3DPixelType View3D::GetVal (unsigned int x, unsigned int y)
{
   
    View3DPixelType val;
    OutputImageType::IndexType index;
    index [0] = x;
    index [1] = y;
    index [2] = 0;

    PointType outputPoint;
    PointType inputPoint;

    _res_image->TransformIndexToPhysicalPoint( index, outputPoint );
 
    // Compute corresponding input pixel continuous index

    inputPoint = _transform->TransformPoint(outputPoint);

   
    ContinuousIndexType inputIndex;
    _volume->TransformPhysicalPointToContinuousIndex(inputPoint, 
inputIndex);
   
    if( _interpolator->IsInsideBuffer(inputIndex) )
    {
          val =  _interpolator->EvaluateAtContinuousIndex(inputIndex);;
    }
    else
    {
        val = _DefaultPixelValue;
    }
    return val;
}



******************* end of code ********************************



More information about the Insight-users mailing list