Skip to content

Commit

Permalink
Merge pull request #9 from vprudente/main
Browse files Browse the repository at this point in the history
Minor improvements fixes
  • Loading branch information
zapaishchykova authored Aug 9, 2023
2 parents cfaef76 + dbec89e commit 8092bdf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions SegmentationReview/SegmentationReview.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from slicer.util import VTKObservationMixin
import ctk
import qt
from datetime import datetime

try:
import pandas as pd
Expand Down Expand Up @@ -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)

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

0 comments on commit 8092bdf

Please sign in to comment.