Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS returns SPL #491

Open
KrisThielemans opened this issue Apr 11, 2020 · 1 comment
Open

LPS returns SPL #491

KrisThielemans opened this issue Apr 11, 2020 · 1 comment

Comments

@KrisThielemans
Copy link
Collaborator

@ashgillman I find the following confusing:

CartesianCoordinate3D<float> LPS = image.get_LPS_for_indices();
const float S = LPS[1];
const float L = LPS[3];

i.e. I'd expect that LPS coordinates are in order LPS.

I guess you did this because of the usual STIR z,y,x convention (where z is along the axis of the scanner), but we never call this get_xyz.

This seems quite non-trivial to change however. Moreover, it would also have repercussions for SIRF I guess (@rijobro @evgueni-ovtchinnikov, please confirm).

Not sure what to do with this...

@ashgillman
Copy link
Collaborator

ashgillman commented May 25, 2020

Sorry, I missed this.

Hmm, looks like this is handled here:

swap_axes_based_on_orientation(const CartesianCoordinate3D<float>& coords,
const PatientPosition patient_position)
{
CartesianCoordinate3D<float> flip_coords = coords;
// STIR coordinates run:
// x: left to right as you face the scanner (as seen from the bed side)
// y: top to bottom of the scanner
// z: running from deep in the scanner out along the bed (as seen from the bed
// side)
// ITK coordinates are defined w.r.t LPS
switch (patient_position.get_position())
{
case PatientPosition::unknown_position: // If unknown, assume HFS
case PatientPosition::HFS: // HFS means currently in patient LPI
flip_coords.z() *= -1;
break;
case PatientPosition::HFP: // HFP means currently in patient RAI
flip_coords.x() *= -1;
flip_coords.y() *= -1;
flip_coords.z() *= -1;
break;
case PatientPosition::FFS: // FFS means currently in patient RPS
flip_coords.x() *= -1;
break;
case PatientPosition::FFP: // FFP means currently in patient LAS
flip_coords.y() *= -1;
break;
default:
throw std::runtime_error("Unsupported patient position, can't convert to LPS.");
}
return flip_coords;
}

I use the CartesianCoordinate3D.{x(),y(),z()} interface as opposed to indexing. So it would seem the issue might be with the use of that data type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants