From 469c550ccbf07ef443be43970d221d1157fa249f Mon Sep 17 00:00:00 2001 From: Shelly Belsky Date: Sun, 24 Nov 2024 13:48:56 -0500 Subject: [PATCH] STYLE: Clean up UI file and make sure all elements are labeled --- AutoscoperM/AutoscoperM.py | 20 ++-- AutoscoperM/Resources/UI/AutoscoperM.ui | 122 ++++++++++++------------ 2 files changed, 71 insertions(+), 71 deletions(-) diff --git a/AutoscoperM/AutoscoperM.py b/AutoscoperM/AutoscoperM.py index 0ebd9a3..33e3aa8 100644 --- a/AutoscoperM/AutoscoperM.py +++ b/AutoscoperM/AutoscoperM.py @@ -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) @@ -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 @@ -502,7 +502,7 @@ def onGenerateConfig(self): mainOutputDir=mainOutputDir, configFileName=configFileName, tiffSubDir=tiffSubDir, - vrgSubDir=vrgSubDir, + radiographSubDir=radiographSubDir, calibrationSubDir=calibrationSubDir, trialList=trialList, partialVolumeList=partialVolumeList, @@ -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") @@ -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( @@ -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 @@ -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, ) @@ -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): """ diff --git a/AutoscoperM/Resources/UI/AutoscoperM.ui b/AutoscoperM/Resources/UI/AutoscoperM.ui index dd0eca6..a380b3e 100644 --- a/AutoscoperM/Resources/UI/AutoscoperM.ui +++ b/AutoscoperM/Resources/UI/AutoscoperM.ui @@ -147,7 +147,7 @@ - + Output Directory: @@ -161,7 +161,7 @@ - + Volume Node: @@ -211,14 +211,14 @@ - + Threshold Value: - + 10000 @@ -227,8 +227,15 @@ + + + + Generate Segmentations + + + - + Margin Size: @@ -241,29 +248,22 @@ - - - - Generate Segmentations - - - - + OR - + Segmentation from Model - + false @@ -273,7 +273,7 @@ - + false @@ -283,7 +283,7 @@ - + false @@ -307,14 +307,14 @@ false - - + + Segmentation Node: - + true @@ -332,14 +332,14 @@ - + Generate Partial Volumes - + Load Partial Volumes @@ -368,7 +368,7 @@ - + Partial Volume Subdirectory: @@ -382,7 +382,7 @@ - + Partial Volume Transforms Subdirectory: @@ -396,7 +396,7 @@ - + 75 @@ -409,7 +409,7 @@ - + 75 @@ -422,7 +422,7 @@ - + 75 @@ -451,7 +451,7 @@ - + Tracking Subdirectory: @@ -465,7 +465,7 @@ - + Model Subdirectory: @@ -499,7 +499,7 @@ - + true @@ -508,18 +508,11 @@ - - - - Populate From Radiographs Subdirectory - - - - + and enter : @@ -533,19 +526,29 @@ - + .cfg + + + + Populate From Radiographs Subdirectory + + + - + Select Partial Volumes: + + + @@ -553,16 +556,16 @@ - - - - + Select Camera Calibrations: + + + @@ -570,15 +573,12 @@ - - - - + Optimization Offsets: @@ -645,7 +645,7 @@ - + Volume Flip: @@ -679,7 +679,7 @@ - + Render Resolution: (width,height) @@ -706,7 +706,7 @@ - + Voxel Size: @@ -821,7 +821,7 @@ segGen_autoRadioButton toggled(bool) - segGen_ThresholdSpinBox + segGen_thresholdSpinBox setEnabled(bool) @@ -835,9 +835,9 @@ - segGen_fileRadioButton + segSTL_loadRadioButton toggled(bool) - segGen_lineEdit + segSTL_modelsDir setEnabled(bool) @@ -883,9 +883,9 @@ - segGen_fileRadioButton + segSTL_loadRadioButton toggled(bool) - importModelsButton + segSTL_importModelsButton setEnabled(bool) @@ -901,7 +901,7 @@ segGen_autoRadioButton toggled(bool) - segmentationButton + segGen_segmentationButton setEnabled(bool) @@ -915,9 +915,9 @@ - segGen_fileRadioButton + segSTL_loadRadioButton toggled(bool) - segSTLModelsDirLabel + segSTL_modelsDirLabel setEnabled(bool) @@ -933,7 +933,7 @@ segGen_autoRadioButton toggled(bool) - segThresholdLabel + segGen_thresholdLabel setEnabled(bool) @@ -949,7 +949,7 @@ segGen_autoRadioButton toggled(bool) - segMarginSizeLabel + segGen_marginSizeLabel setEnabled(bool)