From 11098efb371c6e2604eb0a6b041aabbb1958b18d Mon Sep 17 00:00:00 2001 From: vprudente <57689786+vprudente@users.noreply.github.com> Date: Wed, 9 Aug 2023 14:26:30 -0400 Subject: [PATCH] fix "checked" counter and upt naming --- SegmentationReview/SegmentationReview.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SegmentationReview/SegmentationReview.py b/SegmentationReview/SegmentationReview.py index c13ace9..4dd010c 100644 --- a/SegmentationReview/SegmentationReview.py +++ b/SegmentationReview/SegmentationReview.py @@ -9,6 +9,7 @@ from slicer.util import VTKObservationMixin import ctk import qt +from datetime import datetime try: import pandas as pd @@ -159,7 +160,7 @@ def overwrite_mask_clicked(self): # Get the file path where you want to save the segmentation node file_path = self.directory+"/t.seg.nrrd" # Save the segmentation node to file as nifti - file_path_nifti = self.segmentation_files[self.current_index].split(".")[0]+"_upd.nii.gz" + file_path_nifti = self.segmentation_files[self.current_index].split(".")[0]+f"_{datetime.now().strftime('%Y-%m-%d_%H:%M:%S')}.nii.gz" # Save the segmentation node to file slicer.util.saveNode(self.segmentation_node, file_path) @@ -206,7 +207,7 @@ def onAtlasDirectoryChanged(self, directory): self.segmentation_files.append(directory+"/"+file.split(".")[0]+"_mask.nii.gz") else: print("No mask for file: ", file) - self.ui.status_checked.setText("Checked: "+ str(self.current_index) + " / "+str(self.n_files-1)) + self.ui.status_checked.setText("Checked: "+ str(self.current_index) + " / "+str(self.n_files)) # load first file with mask self.load_nifti_file() @@ -230,12 +231,12 @@ def save_and_next_clicked(self): data = {'file': [self.nifti_files[self.current_index]], 'annotation': [likert_score],'comment': [self.ui.comment.toPlainText()]} df = pd.DataFrame(data) df.to_csv(self.directory+"/annotations.csv", mode='a', index=False, header=False) + self.ui.status_checked.setText("Checked: "+ str(self.current_index+1) + " / "+str(self.n_files)) # go to the next file if there is one if self.current_index < self.n_files-1: self.current_index += 1 self.load_nifti_file() - self.ui.status_checked.setText("Checked: "+ str(self.current_index) + " / "+str(self.n_files-1)) self.ui.comment.setPlainText("") else: print("All files checked")