Skip to content

Commit

Permalink
WIP: Draft to assign camera and radiograph order
Browse files Browse the repository at this point in the history
Reordered Camera lists first (as in cfg v1.1 format)
Suggestion to use 2 lists in camera calibration and radiograph sub selection
  • Loading branch information
amymmorton committed Nov 26, 2024
1 parent 469c550 commit 0f9c9e1
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 147 deletions.
20 changes: 13 additions & 7 deletions AutoscoperM/AutoscoperM.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)]

Expand Down Expand Up @@ -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):
"""
Expand All @@ -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"):
"""
Expand Down
Loading

0 comments on commit 0f9c9e1

Please sign in to comment.