Skip to content

Commit

Permalink
Merge pull request #207 from che85/improvements
Browse files Browse the repository at this point in the history
Demo mode and flicker, rock mode opacity issue fixes
  • Loading branch information
che85 authored Aug 12, 2016
2 parents 147791b + 567e2b7 commit a28c22f
Showing 3 changed files with 56 additions and 48 deletions.
5 changes: 4 additions & 1 deletion SliceTracker/Resources/default.cfg
Original file line number Diff line number Diff line change
@@ -16,4 +16,7 @@ Filename: mpReviewColors.csv

[Evaluation]
# possible layouts: LAYOUT_FOUR_UP, LAYOUT_SIDE_BY_SIDE
Default_Layout: LAYOUT_FOUR_UP
Default_Layout: LAYOUT_FOUR_UP

[Modes]
Demo_Mode: False
94 changes: 48 additions & 46 deletions SliceTracker/SliceTracker.py
Original file line number Diff line number Diff line change
@@ -261,8 +261,7 @@ def onReload(self):
def clearData(self):
self.simulatePreopPhaseButton.enabled = False
self.simulateIntraopPhaseButton.enabled = False
if self.preopTransferWindow:
self.preopTransferWindow.hide()
self.cleanupPreopDICOMReceiver()
if self.currentCaseDirectory:
self.logic.closeCase(self.currentCaseDirectory)
self.currentCaseDirectory = None
@@ -302,11 +301,11 @@ def updateOutputFolder(self):
self.generatedOutputDirectory = ""

def createPatientWatchBox(self):
watchBoxInformation = [WatchBoxAttribute('PatientID', 'Patient ID: ', DICOMTAGS.PATIENT_ID),
WatchBoxAttribute('PatientName', 'Patient Name: ', DICOMTAGS.PATIENT_NAME),
WatchBoxAttribute('DOB', 'Date of Birth: ', DICOMTAGS.PATIENT_BIRTH_DATE),
WatchBoxAttribute('StudyDate', 'Preop Study Date: ', DICOMTAGS.STUDY_DATE)]
self.patientWatchBox = DICOMBasedInformationWatchBox(watchBoxInformation)
self.patientWatchBoxInformation = [WatchBoxAttribute('PatientID', 'Patient ID: ', DICOMTAGS.PATIENT_ID, self.demoMode),
WatchBoxAttribute('PatientName', 'Patient Name: ', DICOMTAGS.PATIENT_NAME, self.demoMode),
WatchBoxAttribute('DOB', 'Date of Birth: ', DICOMTAGS.PATIENT_BIRTH_DATE, self.demoMode),
WatchBoxAttribute('StudyDate', 'Preop Study Date: ', DICOMTAGS.STUDY_DATE)]
self.patientWatchBox = DICOMBasedInformationWatchBox(self.patientWatchBoxInformation)
self.layout.addWidget(self.patientWatchBox)

intraopWatchBoxInformation = [WatchBoxAttribute('StudyDate', 'Intraop Study Date: ', DICOMTAGS.STUDY_DATE),
@@ -368,7 +367,8 @@ def setup(self):
"VolumeClip.", "Missing Extension")

self.ratingWindow = RatingWindow(int(self.getSetting("Maximum_Rating_Score")))
self.ratingWindow.disableWidgetCheckbox.checked = not bool(self.getSetting("Rating_Enabled"))
self.ratingWindow.disableWidgetCheckbox.checked = not self.getSetting("Rating_Enabled") == "true"
self.demoMode = self.getSetting("Demo_Mode") == "true"
self.sliceAnnotations = []
self.mouseReleaseEventObservers = {}
self.revealCursor = None
@@ -993,6 +993,7 @@ def checkAndWarnUserIfCaseInProgress(self):
return proceed

def startPreopDICOMReceiver(self):
self.cleanupPreopDICOMReceiver()
self.preopTransferWindow = IncomingDataWindow(incomingDataDirectory=self.preopDICOMDataDirectory,
skipText="No Preop available")
self.preopTransferWindow.addObserver(SlicerProstateEvents.IncomingDataSkippedEvent,
@@ -1003,6 +1004,12 @@ def startPreopDICOMReceiver(self):
self.startPreProcessingPreopData)
self.preopTransferWindow.show()

def cleanupPreopDICOMReceiver(self):
if self.preopTransferWindow:
self.preopTransferWindow.hide()
self.preopTransferWindow.removeObservers()
self.preopTransferWindow = None

def onPreopTransferMessageBoxCanceled(self, caller, event):
self.clearData()
self.preopTransferWindow.removeObservers()
@@ -1013,7 +1020,7 @@ def continueWithoutPreopData(self, caller, event):
self.intraopDataDir = self.intraopDICOMDataDirectory

def startPreProcessingPreopData(self, caller=None, event=None):
self.preopTransferWindow.removeObservers()
self.cleanupPreopDICOMReceiver()
self.logic.intraopDataDir = self.intraopDICOMDataDirectory
success = self.invokePreProcessing()
if success:
@@ -1682,50 +1689,45 @@ def showOpacitySliderPopup(self, show):
self.opacitySliderPopup. autoHide = True

def onRockToggled(self):

def startRocking():
self.showOpacitySliderPopup(True)
self.flickerCheckBox.enabled = False
self.wlEffectsToolButton.checked = False
self.wlEffectsToolButton.enabled = False
self.disableWindowLevelEffects()
self.rockTimer.start()
self.opacitySpinBox.value = 0.5 + numpy.sin(self.rockCount / 10.) / 2.
self.rockCount += 1

def stopRocking():
self.wlEffectsToolButton.enabled = True
self.showOpacitySliderPopup(False)
self.flickerCheckBox.enabled = True
self.rockTimer.stop()

if self.rockCheckBox.checked:
startRocking()
self.startRocking()
else:
stopRocking()
self.stopRocking()

def onFlickerToggled(self):

def startFlickering():
self.showOpacitySliderPopup(True)
self.rockCheckBox.setEnabled(False)
self.wlEffectsToolButton.checked = False
self.wlEffectsToolButton.enabled = False
self.disableWindowLevelEffects()
self.flickerTimer.start()
self.opacitySpinBox.value = 1.0 if self.opacitySpinBox.value == 0.0 else 0.0
def startRocking(self):
if self.flickerCheckBox.checked:
self.flickerCheckBox.checked = False
self.wlEffectsToolButton.checked = False
self.wlEffectsToolButton.enabled = False
self.disableWindowLevelEffects()
self.rockTimer.start()
self.opacitySpinBox.value = 0.5 + numpy.sin(self.rockCount / 10.) / 2.
self.rockCount += 1

def stopFlickering():
self.wlEffectsToolButton.enabled = True
self.showOpacitySliderPopup(False)
self.rockCheckBox.setEnabled(True)
self.flickerTimer.stop()
self.opacitySpinBox.value = 0.0
def stopRocking(self):
self.wlEffectsToolButton.enabled = True
self.rockTimer.stop()
self.opacitySpinBox.value = 1.0

def onFlickerToggled(self):
if self.flickerCheckBox.checked:
startFlickering()
self.startFlickering()
else:
stopFlickering()
self.stopFlickering()

def startFlickering(self):
if self.rockCheckBox.checked:
self.rockCheckBox.checked = False
self.wlEffectsToolButton.checked = False
self.wlEffectsToolButton.enabled = False
self.disableWindowLevelEffects()
self.flickerTimer.start()
self.opacitySpinBox.value = 1.0 if self.opacitySpinBox.value == 0.0 else 0.0

def stopFlickering(self):
self.wlEffectsToolButton.enabled = True
self.flickerTimer.stop()
self.opacitySpinBox.value = 1.0

def onCompleteCaseButtonClicked(self):
self.logic.caseCompleted = True
5 changes: 4 additions & 1 deletion SliceTracker/SliceTrackerUtils/configuration.py
Original file line number Diff line number Diff line change
@@ -38,4 +38,7 @@ def loadConfiguration(self):
'../Resources/Colors', colorFilename))

if not self.getSetting("DEFAULT_EVALUATION_LAYOUT"):
self.setSetting("DEFAULT_EVALUATION_LAYOUT", config.get('Evaluation', 'Default_Layout'))
self.setSetting("DEFAULT_EVALUATION_LAYOUT", config.get('Evaluation', 'Default_Layout'))

if not self.getSetting("Demo_Mode"):
self.setSetting("Demo_Mode", config.get('Modes', 'Demo_Mode'))

0 comments on commit a28c22f

Please sign in to comment.