From 0f9c9e175abb7909883dda46903527a5178ccdeb Mon Sep 17 00:00:00 2001 From: Amy M Morton <65619862+amymmorton@users.noreply.github.com> Date: Mon, 25 Nov 2024 20:29:46 -0500 Subject: [PATCH] WIP: Draft to assign camera and radiograph order Reordered Camera lists first (as in cfg v1.1 format) Suggestion to use 2 lists in camera calibration and radiograph sub selection --- AutoscoperM/AutoscoperM.py | 20 +- AutoscoperM/Resources/UI/AutoscoperM.ui | 326 ++++++++++++++---------- 2 files changed, 199 insertions(+), 147 deletions(-) diff --git a/AutoscoperM/AutoscoperM.py b/AutoscoperM/AutoscoperM.py index 33e3aa8..a35ae73 100644 --- a/AutoscoperM/AutoscoperM.py +++ b/AutoscoperM/AutoscoperM.py @@ -217,9 +217,10 @@ def setup(self): 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) self.ui.populateCameraCalListButton.connect("clicked(bool)", self.onPopulateCameraCalList) + self.ui.populateRadFoldersButton.connect("clicked(bool)", self.onPopulateRadFolders) + self.ui.populatePartialVolumeListButton.connect("clicked(bool)", self.onPopulatePartialVolumeList) + # Default output directory self.ui.mainOutputSelector.setCurrentPath( @@ -492,9 +493,11 @@ def onGenerateConfig(self): radiographSubDir = self.ui.radiographSubDir.text calibrationSubDir = self.ui.cameraSubDir.text - trialList = self.ui.trialList + #populate 2 for the radiographyFolderList + camCalList = self.ui.cam1CalList #, self.ui.cam2CalList] concatenate here or 535 below? + trialList = self.ui.rad1List #, self.ui.rad2List partialVolumeList = self.ui.partialVolumeList - camCalList = self.ui.camCalList + # Validate the inputs if not self.logic.validateInputs( @@ -529,6 +532,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! + #camDir1 = [os.path.join(calibrationSubDir, item) for item in get_checked_items(cam1CalList)] camCalFiles = [os.path.join(calibrationSubDir, item) for item in get_checked_items(camCalList)] trialDirs = [os.path.join(radiographSubDir, item) for item in get_checked_items(trialList)] @@ -745,12 +749,13 @@ def onLoadPV(self): slicer.util.messageBox("Success!") - def onPopulateTrialNameList(self): + def onPopulateRadFolders(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.radiographSubDir.text, itemType="dir") + self.populateListFromOutputSubDir(self.ui.rad1List, self.ui.radiographSubDir.text, itemType="dir") + self.populateListFromOutputSubDir(self.ui.rad2List, self.ui.radiographSubDir.text, itemType="dir") def onPopulatePartialVolumeList(self): """ @@ -764,7 +769,8 @@ def onPopulateCameraCalList(self): Populates camera calibration UI list using files from the selected camera directory """ with slicer.util.tryWithErrorDisplay("Failed to compute results.", waitCursor=True): - self.populateListFromOutputSubDir(self.ui.camCalList, self.ui.cameraSubDir.text) + self.populateListFromOutputSubDir(self.ui.cam1CalList, self.ui.cameraSubDir.text) + self.populateListFromOutputSubDir(self.ui.cam2CalList, self.ui.cameraSubDir.text) def populateListFromOutputSubDir(self, listWidget, fileSubDir, itemType="file"): """ diff --git a/AutoscoperM/Resources/UI/AutoscoperM.ui b/AutoscoperM/Resources/UI/AutoscoperM.ui index a380b3e..c092d5e 100644 --- a/AutoscoperM/Resources/UI/AutoscoperM.ui +++ b/AutoscoperM/Resources/UI/AutoscoperM.ui @@ -9,7 +9,7 @@ 0 0 - 811 + 821 1566 @@ -125,6 +125,12 @@ Qt::Vertical + + + 0 + 0 + + @@ -361,7 +367,7 @@ true - true + false true @@ -496,96 +502,115 @@ false - - - - - - true + + + + + + 0.100000000000000 - - Select Trial Names: + + 0.100000000000000 - - - - - - - and enter : + + + + 0.100000000000000 + + + 0.100000000000000 - - - + + + true + + 3 + + + 1.000000000000000 + - - + + - .cfg + Optimization Offsets: - - + + - Populate From Radiographs Subdirectory + Flip Z - - - - Select Partial Volumes: + + + + 0.100000000000000 + + + 0.100000000000000 - - + + + + Volume Flip: + + - - + + - Populate From Volume Subdirectory + Generate Config File - - + + - Select Camera Calibrations: + Render Resolution: (width,height) - - + + + + Flip X + + + false + + - - + + - Populate From Camera Subdirectory + Voxel Size: - - - - - - + + - Optimization Offsets: + Flip Y + + + false - - + + 0.100000000000000 @@ -594,8 +619,8 @@ - - + + 0.100000000000000 @@ -604,38 +629,44 @@ - - - - 0.100000000000000 + + + + true + + + 3 - 0.100000000000000 + 1.000000000000000 - - - - 0.100000000000000 + + + + true + + + 3 - 0.100000000000000 + 1.000000000000000 - - - - 0.100000000000000 + + + + 999999999 - 0.100000000000000 + 1760 - - + + 0.100000000000000 @@ -644,120 +675,129 @@ - - - - Volume Flip: + + + + 999999999 + + + 1760 - - + + + + + + - Flip X - - - false + Populate From Volume Subdirectory - - + + - Flip Y + Populate From Radiographs Subdirectory - - false + + + + + + true - - + + - Flip Z + Config Trial Name: - - + + + + + - Render Resolution: (width,height) + Cam 2 - - - - 999999999 + + + + true - - 1760 + + Select Paired Radiograph Subdirectories : - - - - 999999999 - - - 1760 + + + + + + + .cfg - - + + - Voxel Size: + Select Partial Volumes: - - - - true - - - 3 - - - 1.000000000000000 + + + + Cam 1 - - - - true - - - 3 - - - 1.000000000000000 + + + + + + + Select Paired Camera Calibrations: - - - - true - - - 3 + + + + Populate From Camera Subdirectory - - 1.000000000000000 + + + + + + + + + Cam 1 - - + + - Generate Config File + Cam 2 + + + @@ -768,6 +808,12 @@ Qt::Vertical + + + 0 + 0 + +