Skip to content

Commit

Permalink
STYLE: Clean up UI file and make sure all elements are labeled
Browse files Browse the repository at this point in the history
  • Loading branch information
sbelsk committed Nov 24, 2024
1 parent df78491 commit 469c550
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 71 deletions.
20 changes: 10 additions & 10 deletions AutoscoperM/AutoscoperM.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ def setup(self):
self.ui.volumeSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onCurrentNodeChanged)
self.ui.tiffGenButton.connect("clicked(bool)", self.onGeneratePartialVolumes)
self.ui.configGenButton.connect("clicked(bool)", self.onGenerateConfig)
self.ui.segmentationButton.connect("clicked(bool)", self.onSegmentation)
self.ui.importModelsButton.connect("clicked(bool)", self.onImportModels)
self.ui.segGen_segmentationButton.connect("clicked(bool)", self.onSegmentation)
self.ui.segSTL_importModelsButton.connect("clicked(bool)", self.onImportModels)
self.ui.loadPVButton.connect("clicked(bool)", self.onLoadPV)
self.ui.populateTrialNameListButton.connect("clicked(bool)", self.onPopulateTrialNameList)
self.ui.populatePartialVolumeListButton.connect("clicked(bool)", self.onPopulatePartialVolumeList)
Expand Down Expand Up @@ -489,7 +489,7 @@ def onGenerateConfig(self):
configPath = os.path.join(mainOutputDir, f"{configFileName}.cfg")

tiffSubDir = self.ui.tiffSubDir.text
vrgSubDir = self.ui.vrgSubDir.text
radiographSubDir = self.ui.radiographSubDir.text
calibrationSubDir = self.ui.cameraSubDir.text

trialList = self.ui.trialList
Expand All @@ -502,7 +502,7 @@ def onGenerateConfig(self):
mainOutputDir=mainOutputDir,
configFileName=configFileName,
tiffSubDir=tiffSubDir,
vrgSubDir=vrgSubDir,
radiographSubDir=radiographSubDir,
calibrationSubDir=calibrationSubDir,
trialList=trialList,
partialVolumeList=partialVolumeList,
Expand All @@ -513,7 +513,7 @@ def onGenerateConfig(self):
if not self.logic.validatePaths(
mainOutputDir=mainOutputDir,
tiffDir=os.path.join(mainOutputDir, tiffSubDir),
vrgDir=os.path.join(mainOutputDir, vrgSubDir),
radiographSubDir=os.path.join(mainOutputDir, radiographSubDir),
calibDir=os.path.join(mainOutputDir, calibrationSubDir),
):
raise ValueError("Invalid paths")
Expand All @@ -530,7 +530,7 @@ def get_checked_items(listWidget):
# extract filenames from UI lists, and use them to construct the paths relative to mainOutputDir
# FIXME: don't assume the list of camera files is given in the same order as list of radiograph root dir!
camCalFiles = [os.path.join(calibrationSubDir, item) for item in get_checked_items(camCalList)]
trialDirs = [os.path.join(vrgSubDir, item) for item in get_checked_items(trialList)]
trialDirs = [os.path.join(radiographSubDir, item) for item in get_checked_items(trialList)]

if len(camCalFiles) != len(trialDirs):
raise ValueError(
Expand Down Expand Up @@ -615,8 +615,8 @@ def onImportModels(self):
raise ValueError("Invalid inputs")
return

if self.ui.segGen_fileRadioButton.isChecked():
segmentationFileDir = self.ui.segGen_lineEdit.currentPath
if self.ui.segSTL_loadRadioButton.isChecked():
segmentationFileDir = self.ui.segSTL_modelsDir.currentPath
if not self.logic.validatePaths(segmentationFileDir=segmentationFileDir):
raise ValueError("Invalid paths")
return
Expand Down Expand Up @@ -663,7 +663,7 @@ def onSegmentation(self):
self.logic.cleanFilename(currentVolumeNode.GetName(), i)
segmentationNode = SubVolumeExtraction.automaticSegmentation(
currentVolumeNode,
self.ui.segGen_ThresholdSpinBox.value,
self.ui.segGen_thresholdSpinBox.value,
self.ui.segGen_marginSizeSpin.value,
progressCallback=self.updateProgressBar,
)
Expand Down Expand Up @@ -750,7 +750,7 @@ def onPopulateTrialNameList(self):
Populates trial name UI list using files from the selected radiograph directory
"""
with slicer.util.tryWithErrorDisplay("Failed to compute results.", waitCursor=True):
self.populateListFromOutputSubDir(self.ui.trialList, self.ui.vrgSubDir.text, itemType="dir")
self.populateListFromOutputSubDir(self.ui.trialList, self.ui.radiographSubDir.text, itemType="dir")

def onPopulatePartialVolumeList(self):
"""
Expand Down
Loading

0 comments on commit 469c550

Please sign in to comment.