[Insight-users] RaycastInterpolateImageFunction

jef vdmb jvdmb at hotmail.com
Tue Jul 1 08:09:08 EDT 2008


Hi Luis,
 
The coordinates of the origin (the coordinates of the pixel with index zero) are as they should be. 
 
For example: 
*an input image with origin [0,0,0], ie in the corner
* an isocenter given by [0,0,0], thus set to the image origin
*mSourceToScreen=1536; and mSourceToAxis=1000 and (mSourceToScreen - mSourceToAxis)=536
 
 
//I define the focalpoint, in this case [1000,0,0] 
focalpoint[0]= mIsoCenter[0] + mSourceToAxis;
focalpoint[1]= mIsoCenter[1];
focalpoint[2]= mIsoCenter[2];
 
//And the output origin is centered around the projection of the isocenter in the YZ plane, in this case  [-536, -204.8 -204.8]  for an output image with size 512 and 0.8 pixelsize.
originOutput[0] = mIsoCenter[0]- (mSourceToScreen - mSourceToAxis); 
originOutput[1] = mIsoCenter[1]-(((double)sizeOuput[1]*spacingOutput[1])/2.);
 originOutput[2] = mIsoCenter[2]-((double)sizeOuput[2]*spacingOutput[2]/2.); 
 
Output origin is set correctly, also the point in the middle of the output image was projected perpendicularly, as it should, Indicating the focalpoint was set correctly with respect to the outputimage. The input image was however not set correctly. The point that was projected to the middle of the ouputimage is the center of the input volume. It should have been the point with coordinates of the isocenter, in this case =[0,0,0] , ie the corner of the input image. 
 
The example DigitallyReconstructedRadiograph1.cxx seems to confirm my reasoning. The geometry of the projection is also calculated with respect to imOrigin, defined to be the input image origin + a shilft to the center of the volume. 
 
//.......
 InputImageType::PointType   imOrigin = image->GetOrigin();
  InputImageType::SpacingType imRes    = image->GetSpacing();
 
  typedef InputImageType::RegionType     InputImageRegionType;
  typedef InputImageRegionType::SizeType InputImageSizeType;
 
  InputImageRegionType imRegion = image->GetBufferedRegion();
  InputImageSizeType   imSize   = imRegion.GetSize();
 
  imOrigin[0] += imRes[0] * static_cast( imSize[0] )/2.0; 
  imOrigin[1] += imRes[1] * static_cast( imSize[1] )/ 2.0; 
  imOrigin[2] += imRes[2] * static_cast( imSize[2] )/ 2.0; 
 
//.......
 
  InterpolatorType::InputPointType focalpoint;
 
  focalpoint[0]= imOrigin[0];
  focalpoint[1]= imOrigin[1];
  focalpoint[2]= imOrigin[2] - sid/2.;
 
//....
 
  double origin[ Dimension ];
 
  origin[0] = imOrigin[0] + o2Dx - sx*((double) dx - 1.)/2.; 
  origin[1] = imOrigin[1] + o2Dy - sy*((double) dy - 1.)/2.; 
  origin[2] = imOrigin[2] + sid/2.; 
 
  filter->SetOutputOrigin( origin );
 
 
If I am not mistaken, there seems to be an implicit shift to the center of volume in the raycast filter. However I did not find any documentation indicating this, and was wondering why?
 
Thanks for your help,
jef
----------------------------------------
> Date: Sat, 28 Jun 2008 18:51:44 -0400
> From: luis.ibanez at kitware.com
> To: jvdmb at hotmail.com
> CC: insight-users at itk.org
> Subject: Re: [Insight-users] RaycastInterpolateImageFunction
> 
> Hi Jef,
> 
> What were the coordinates of the origin of the output image ?
> 
> Please keep in mind that normally those are the coordinates
> of the first pixel in the image, which means that they relate
> to a corner (not the center) of the image.
> 
> Please let us know,
> 
> 
>     Thanks
> 
> 
>        Luis
> 
> 
> ----------------
> jef vdmb wrote:
>> Hi, 
>> 
>> I am trying to make a digitally reconstructed radiograph, using  the RaycastInterpolateImageFunction. I started with  the example DigitallyReconstructedRadiograph1.cxx, but would like to define the geometry differently.  I define the focal point and the origin of the output image. Sofar so good. The input image is placed in this physical space just by using it's origin (which was correctly set in a previous step). However, it doesn't seem to be in the right place, ie the point which should be projected in the middle of the output image, isn't there. When I calculate focalpoint and output origin with respect to the middle of the input volume (as you would do if the origin of the physical space were to be defined in the center of this volume) the projection is as expected. It seems that by default the  center of the input volume is the origin of physical coordinate space. The image origin specified in the header of the image is just added to this one. Does this make any sens
> e? 
>> 
>> This is how I define the projection geometry:
>> 
>> 
>>    focalpoint[0]= mIsoCenter[0] + mSourceToAxis;
>>   focalpoint[1]= mIsoCenter[1];
>>   focalpoint[2]= mIsoCenter[2];
>>   interpolator->SetFocalPoint(focalpoint);
>> 
>> //projection in the YZ plane
>>   originOutput[0] = mIsoCenter[0]- (mSourceToScreen - mSourceToAxis); 
>>   originOutput[1] = mIsoCenter[1]-(((double)sizeOuput[1]*spacingOutput[1])/2.);
>>   originOutput[2] = mIsoCenter[2]-((double)sizeOuput[2]*spacingOutput[2]/2.); 
>> 
>>  
>> a point in the image whith coordinates of the isocenter should be projected in the middle of output image right?
>> 
>> 
>> Thank you in advance for your help,
>> Jef
>> _________________________________________________________________
>> The other season of giving begins 6/24/08. Check out the i’m Talkathon.
>> http://www.imtalkathon.com?source=TXT_EML_WLH_SeasonOfGiving
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>> 

_________________________________________________________________
Making the world a better place one message at a time.
http://www.imtalkathon.com/?source=EML_WLH_Talkathon_BetterPlace


More information about the Insight-users mailing list