Skip to content

Commit

Permalink
BUG: Remove obsolete VRG Generation functionality
Browse files Browse the repository at this point in the history
Removes the 'Manual Camera Placement' and 'Automatic Camera Placement'
VRG Generation UI groups from the Pre-Processing modules, along with all
of their associated backend code. This includes the removal of the
CalculateDataIntensityDensity and VirtualRadiographGeneration modules.
The support for camera placement is superseded by the hierarchical
registration capability.
  • Loading branch information
sbelsk authored and jcfr committed Nov 18, 2024
1 parent 34fa24c commit 9f5e88c
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 1,435 deletions.
413 changes: 1 addition & 412 deletions AutoscoperM/AutoscoperM.py

Large diffs are not rendered by default.

61 changes: 0 additions & 61 deletions AutoscoperM/AutoscoperMLib/IO.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import slicer
import vtk

from .RadiographGeneration import Camera


def loadSegmentation(segmentationNode: slicer.vtkMRMLSegmentationNode, filename: str):
"""
Expand All @@ -35,34 +33,6 @@ def loadSegmentation(segmentationNode: slicer.vtkMRMLSegmentationNode, filename:
return None


def generateCameraCalibrationFile(camera: Camera, filename: str):
"""
Generates a VTK camera calibration json file from the given camera.
:param camera: Camera
:param filename: Output file name
"""
import json

contents = {}
contents["@schema"] = "https://autoscoperm.slicer.org/vtkCamera-schema-1.0.json"
contents["version"] = 1.0
contents["focal-point"] = camera.vtkCamera.GetFocalPoint()
contents["camera-position"] = camera.vtkCamera.GetPosition()
contents["view-up"] = camera.vtkCamera.GetViewUp()
contents["view-angle"] = camera.vtkCamera.GetViewAngle()
contents["image-width"] = camera.imageSize[0]
contents["image-height"] = camera.imageSize[1]
# The clipping-range field is not used by Autoscoper, it is used to communicate
# information between AutoscoperM and VirtualRadiographGeneration modules within Slicer.
contents["clipping-range"] = camera.vtkCamera.GetClippingRange()

contents_json = json.dumps(contents, indent=4)

with open(filename, "w+") as f:
f.write(contents_json)


def generateConfigFile(
mainDirectory: str,
subDirectories: list[str],
Expand Down Expand Up @@ -263,34 +233,3 @@ def writeTRA(fileName: str, transforms: list[vtk.vtkMatrix4x4]) -> None:
with open(fileName, "w+") as traFile:
for row in rowWiseStrings:
traFile.write(",".join(row) + "\n")


def writeTemporyFile(filename: str, data: vtk.vtkImageData) -> str:
"""
Writes a temporary file to the slicer temp directory
:param filename: Output file name
:param data: data
:return: Path to the file
"""

slicerTempDirectory = slicer.app.temporaryPath

# write vtk image data as a vtk file
writer = vtk.vtkMetaImageWriter()
writer.SetFileName(os.path.join(slicerTempDirectory, filename))
writer.SetInputData(data)
writer.Write()
return writer.GetFileName()


def removeTemporyFile(filename: str):
"""
Removes a temporary file from the slicer temp directory
:param filename: Output file name
"""

slicerTempDirectory = slicer.app.temporaryPath
os.remove(os.path.join(slicerTempDirectory, filename))
239 changes: 0 additions & 239 deletions AutoscoperM/AutoscoperMLib/RadiographGeneration.py

This file was deleted.

1 change: 0 additions & 1 deletion AutoscoperM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ set(MODULE_PYTHON_SCRIPTS
${MODULE_NAME}.py
${MODULE_NAME}Lib/__init__.py
${MODULE_NAME}Lib/IO.py
${MODULE_NAME}Lib/RadiographGeneration.py
${MODULE_NAME}Lib/SubVolumeExtraction.py
)

Expand Down
Loading

0 comments on commit 9f5e88c

Please sign in to comment.