Skip to content

Commit

Permalink
small bug fix
Browse files Browse the repository at this point in the history
Former-commit-id: 7a27ee3
  • Loading branch information
Vishwesh4 committed Dec 11, 2021
1 parent 3e374bf commit 9c20b59
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,5 @@ examples/process_one.py

tests/temp_folder*
examples/data_test
data
demo.py
1 change: 1 addition & 0 deletions imgtools/autopipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def save_data(self):
files = glob.glob(os.path.join(self.output_directory,".temp","*.pkl"))
for file in files:
subject_id = ("_").join(file.replace("/","_").replace(".","_").split("_")[-3:-1])
subject_id = file.replace(".","/").split("/")[-2][5:] #From temp_ considers
with open(file,"rb") as f:
metadata = pickle.load(f)
self.output_df.loc[subject_id, list(metadata.keys())] = list(metadata.values())
Expand Down
4 changes: 2 additions & 2 deletions imgtools/io/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ def load_from_nrrd(
path_mod = os.path.join(path,extension.split(".")[0],f"{subject_id}_{extra}{extension}.nrrd")
#All modalities except RTSTRUCT should be of type torchIO.ScalarImage
if os.path.exists(path_mod):
if col!="RTSTRUCT":
if col.split("_")[0]!="RTSTRUCT":
temp[f"mod_{col}"] = tio.ScalarImage(path_mod)
else:
temp[f"mod_{col}"] = tio.LabelImage(path_mod)
temp[f"mod_{col}"] = tio.LabelMap(path_mod)
else:
temp[f"mod_{col}"] = None
#For including metadata
Expand Down

0 comments on commit 9c20b59

Please sign in to comment.