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: Remove obsolete VRG Generation functionality #140

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
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
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):
"""
jcfr marked this conversation as resolved.
Show resolved Hide resolved
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
Loading