Skip to content

Commit

Permalink
Use image origin to cope w irregular slice spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Jan 16, 2025
1 parent 51e985f commit 3d4e4cd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/image/planeHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,23 @@ export class PlaneHelper {
// get origin
const planeOrigin = this.getPositionFromPlanePoint(
new Point2D(0, 0), planePoint.getZ());
// find image origin
const origins = this.#imageGeometry.getOrigins();
const closestOriginIndex = planeOrigin.getClosest(origins);
const imageOrigin = origins[closestOriginIndex];

// use image origin for scroll to cope with
// possible irregular slice spacing
const pValues = planeOrigin.getValues();
const iValues = imageOrigin.getValues();
const scrollDimIndex = this.getNativeScrollDimIndex();
pValues[scrollDimIndex] = iValues[scrollDimIndex];

// plane cosines
const cosines = this.getCosines();

return [
planeOrigin,
new Point3D(pValues[0], pValues[1], pValues[2]),
new Point3D(cosines[0], cosines[1], cosines[2]),
new Point3D(cosines[3], cosines[4], cosines[5])
];
Expand Down

0 comments on commit 3d4e4cd

Please sign in to comment.