Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modified existing code to give color to case list based on status #154

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions SlicerCART/src/SlicerCART.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def onSelectVolumesFolderButton(self):
return

self.Cases = sorted([os.path.split(i)[-1] for i in self.CasesPaths])

print(self.Cases)
self.reset_ui()

self.ui.pushButton_Interpolate.setEnabled(True)
Expand Down Expand Up @@ -1779,31 +1779,30 @@ def set_ui_enabled_options(self):

@enter_function
def update_case_list_colors(self):
if self.outputFolder is None or self.CurrentFolder is None:
return

segmentation_information_path = f'{self.currentOutputPath}{os.sep}{self.currentVolumeFilename}_SegmentationInformation.csv'
segmentation_information_df = None
if os.path.exists(segmentation_information_path):
segmentation_information_df = pd.read_csv(segmentation_information_path)
if self.outputFolder is None or self.CurrentFolder is None:
return

self.ui.SlicerDirectoryListView.clear()
for case in self.Cases:
self.ui.SlicerDirectoryListView.clear()
for case in self.Cases:
case_id = case.split('.')[0]
item = qt.QListWidgetItem(case_id)

currentCaseSegmentationStatus = self.get_segmentation_status(case, segmentation_information_df)
if currentCaseSegmentationStatus == 0:
item.setForeground(qt.QColor(self.foreground))
elif currentCaseSegmentationStatus == 1:
item.setForeground(qt.QColor('orange'))
elif currentCaseSegmentationStatus == 2:
item.setForeground(qt.QColor('green'))

segmentation_information_path = f'{self.currentOutputPath}{os.sep}{case_id}_SegmentationInformation.csv'
print(segmentation_information_path)
segmentation_information_df = None
if os.path.exists(segmentation_information_path):
segmentation_information_df = pd.read_csv(segmentation_information_path)
currentCaseSegmentationStatus = self.get_segmentation_status(case, segmentation_information_df)
if currentCaseSegmentationStatus == 0:
item.setForeground(qt.QColor(self.foreground))
elif currentCaseSegmentationStatus == 1:
item.setForeground(qt.QColor('orange'))
elif currentCaseSegmentationStatus == 2:
item.setForeground(qt.QColor('green'))

self.ui.SlicerDirectoryListView.addItem(item)
else:
return



def get_segmentation_status(self, case, segmentation_information_df):
self.annotator_name = self.ui.Annotator_name.text

Expand Down