# image position patient question (easy)

• 10-02-2007, 10:28 AM
unix
image position patient question (easy)
Hi,

In the DICOM header we can find the image position patient of the image
which corresponds with the origin voxel. We can also find the cols/rows
pixel spacing.

I'd like to be able to use those two pieces of information to tell what
image position a different voxel in the image is at.

For example, if the image position patient tag is parsed and the origin
voxel is at x,y,z 0.5, 0.7, 1.0, and the x/y pixel spacing is 0.5,
0.5, what is the IPP of voxel (2,4)?

I would think to take the origin x, and add to it 2 * pixelSpacingX,
take the origin y, add to it 4 * pixelSpacingY.

But how can we tell if we should be multiplying by a positive or
negative pixel spacing?

Thanks,
Mark

• 10-02-2007, 10:28 AM
unix
Re: image position patient question (easy)
No.

You also need to account for the orientation of the slice, in
Image Orientation (Patient), which is a unit vector of x, y and z
along the row and the column - these vectors take care of the sign
you are referring to; the row and column pixel spacing values are
always positive.

So:

x = originX + row*colDirX*spacingBetweenRows + column*rowDirX*spacingBetweenCols
y = originY + row*colDirY*spacingBetweenRows + column*rowDirY*spacingBetweenCols
z = originZ + row*colDirZ*spacingBetweenRows + column*rowDirZ*spacingBetweenCols

Given:

originX,Y,Z are the displacement from the origin of the center of the TLHC voxel
i.e., the three values of Image Position (Patient)

rowDirX,Y,Z are the components of the unit vector in the row direction
i.e., the first three values of Image Orientation (Patient)

colDirX,Y,Z are the components of the unit vector in the column direction
i.e., the second three values of Image Orientation (Patient)

spacingBetweenRows
i.e., the first value of Pixel Spacing

spacingBetweenCols
i.e., the second value of Pixel Spacing

row,col are the offset from the TLHC voxel in pixels, TLHC being 0,0

David

markww wrote:[color=blue]
> Hi,
>
> In the DICOM header we can find the image position patient of the image
> which corresponds with the origin voxel. We can also find the cols/rows
> pixel spacing.
>
> I'd like to be able to use those two pieces of information to tell what
> image position a different voxel in the image is at.
>
> For example, if the image position patient tag is parsed and the origin
> voxel is at x,y,z 0.5, 0.7, 1.0, and the x/y pixel spacing is 0.5,
> 0.5, what is the IPP of voxel (2,4)?
>
> I would think to take the origin x, and add to it 2 * pixelSpacingX,
> take the origin y, add to it 4 * pixelSpacingY.
>
> But how can we tell if we should be multiplying by a positive or
> negative pixel spacing?
>
> Thanks,
> Mark
>[/color]
• 10-02-2007, 10:29 AM
unix
Re: image position patient question (easy)
David Clunie wrote:[color=blue]
> No.
>
> You also need to account for the orientation of the slice, in
> Image Orientation (Patient), which is a unit vector of x, y and z
> along the row and the column - these vectors take care of the sign
> you are referring to; the row and column pixel spacing values are
> always positive.
>
> So:
>
> x = originX + row*colDirX*spacingBetweenRows + column*rowDirX*spacingBetweenCols
> y = originY + row*colDirY*spacingBetweenRows + column*rowDirY*spacingBetweenCols
> z = originZ + row*colDirZ*spacingBetweenRows + column*rowDirZ*spacingBetweenCols
>
> Given:
>
> originX,Y,Z are the displacement from the origin of the center of the TLHC voxel
> i.e., the three values of Image Position (Patient)
>
> rowDirX,Y,Z are the components of the unit vector in the row direction
> i.e., the first three values of Image Orientation (Patient)
>
> colDirX,Y,Z are the components of the unit vector in the column direction
> i.e., the second three values of Image Orientation (Patient)
>
> spacingBetweenRows
> i.e., the first value of Pixel Spacing
>
> spacingBetweenCols
> i.e., the second value of Pixel Spacing
>
> row,col are the offset from the TLHC voxel in pixels, TLHC being 0,0
>
> David
>
> markww wrote:[color=green]
> > Hi,
> >
> > In the DICOM header we can find the image position patient of the image
> > which corresponds with the origin voxel. We can also find the cols/rows
> > pixel spacing.
> >
> > I'd like to be able to use those two pieces of information to tell what
> > image position a different voxel in the image is at.
> >
> > For example, if the image position patient tag is parsed and the origin
> > voxel is at x,y,z 0.5, 0.7, 1.0, and the x/y pixel spacing is 0.5,
> > 0.5, what is the IPP of voxel (2,4)?
> >
> > I would think to take the origin x, and add to it 2 * pixelSpacingX,
> > take the origin y, add to it 4 * pixelSpacingY.
> >
> > But how can we tell if we should be multiplying by a positive or
> > negative pixel spacing?
> >
> > Thanks,
> > Mark
> >[/color][/color]

David,

Thank you very much for taking time to help me, this is great. I use
dcmtk and wonder if it would be possible to convince their team to add
functions like this to their project as I see questions about image
orientation and position pretty often.

Again, thank you very much,
Mark

• 10-02-2007, 10:29 AM
unix
Re: image position patient question (easy)
markww wrote:[color=blue]
> Thank you very much for taking time to help me, this is great. I use
> dcmtk and wonder if it would be possible to convince their team to add
> functions like this to their project as I see questions about image
> orientation and position pretty often.[/color]

it is probably easier for me (being member of the OFFIS DICOM team) to answer this question
than for David Clunie, who is (unfortunately) not :-)
The standard answer goes like this: If you are willing to contribute to the toolkit,
we'll be happy to merge your contribution into the code repository.

Regards,
Marco Eichelberg
OFFIS