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

BUG: Fix generated partial volumes misaligned with input volume node #147

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions AutoscoperM/AutoscoperM.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,11 +611,19 @@ def onLoadPV(self):
)
return

# get the IJK to RAS direction matrix from original input volume
parentVolume = self.ui.volumeSelector.currentNode()
parentIJKToRAS = vtk.vtkMatrix4x4()
parentVolume.GetIJKToRASDirectionMatrix(parentIJKToRAS)

# check 3 transform files have been generated (translation, scale and combined)
# and load only the combined scale and translation transform for each generated partial volume
for i in range(len(vols)):
nodeName = os.path.splitext(os.path.basename(vols[i]))[0]
volumeNode = slicer.util.loadVolume(vols[i])
# ensure we maintain the original RAS/LPS directions from the parent volume
volumeNode.SetIJKToRASDirectionMatrix(parentIJKToRAS)

translationTransformFileName = os.path.join(mainOutputDir, transformSubDir, f"{nodeName}_t.tfm")
scaleTranformFileName = os.path.join(mainOutputDir, transformSubDir, f"{nodeName}_scale.tfm")
transformFileName = os.path.join(mainOutputDir, transformSubDir, f"{nodeName}.tfm")
Expand Down
Loading