Skip to content

Commit

Permalink
ENH: Fixed an issue which was caused by adding another column to stud…
Browse files Browse the repository at this point in the history
…iesView (issue SlicerProstate#116)

- when selecting study and going to segmentation step and then going back to data selection the same study should be reloaded into the series view which did not work since the studiesView selection changed to none
- when data directory has been selected, studies view is set to collapsed =  False
  • Loading branch information
Christian Herz committed Mar 3, 2016
1 parent bbb1678 commit c04c60b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions mpReview.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def inputDataDir(self, directory):
self.dataDirButton.caption = directory
self.informationWatchBox.setInformation("CurrentDataDir", truncatedPath, toolTip=directory)
if directory:
self.studiesGroupBox.collapsed = False
self.setSetting('InputLocation', directory)
self.checkAndSetLUT()
self.updateStudyTable()
Expand Down Expand Up @@ -1023,8 +1024,9 @@ def onStep1Selected(self):

self.updateStudyStatus()

if len(self.studiesView.selectedIndexes()) > 0:
self.onStudySelected(self.studiesView.selectedIndexes()[0])
if self.currentSelectedStudyIndex:
self.selectStudyModelIndex(self.currentSelectedStudyIndex)
self.onStudySelected(self.currentSelectedStudyIndex)
self.updateSegmentationTabAvailability()
self.setTabsEnabled([2], False)
return True
Expand Down Expand Up @@ -1067,6 +1069,7 @@ def notifyUserAboutMissingEligibleData(self):
self.notificationDialog("No DICOM data could be processed. Please select another directory.")

def fillStudyTable(self):
self.currentSelectedStudyIndex = None
studyItems = []
self.seriesModel.clear()
dirs = self.logic.getStudyNames(self.inputDataDir)
Expand All @@ -1085,8 +1088,11 @@ def fillStudyTable(self):
self.studiesView.horizontalHeader().setResizeMode(0, qt.QHeaderView.Stretch)
if len(studyItems) == 1:
modelIndex = self.studiesModel.index(0,0)
self.studiesView.selectionModel().setCurrentIndex(modelIndex, self.studiesView.selectionModel().Select)
self.studiesView.selectionModel().select(modelIndex, self.studiesView.selectionModel().Select)
self.selectStudyModelIndex(modelIndex)

def selectStudyModelIndex(self, modelIndex):
self.studiesView.selectionModel().setCurrentIndex(modelIndex, self.studiesView.selectionModel().Select)
self.studiesView.selectionModel().select(modelIndex, self.studiesView.selectionModel().Select)

def hasStudyBeenProcessed(self, directory):
resourcesDir = os.path.join(directory,'RESOURCES')
Expand Down Expand Up @@ -1123,6 +1129,7 @@ def updateProgressBar(self, **kwargs):
ModuleWidgetMixin.updateProgressBar(self, progress=self.progress, **kwargs)

def onStudySelected(self, modelIndex):
self.currentSelectedStudyIndex = modelIndex
self.studiesGroupBox.collapsed = True
logging.debug('Row selected: '+self.studiesModel.item(modelIndex.row(),0).text())
selectionModel = self.studiesView.selectionModel()
Expand Down

0 comments on commit c04c60b

Please sign in to comment.