Skip to content

Commit

Permalink
Bug fix in reading nifti list
Browse files Browse the repository at this point in the history
The code for checking type of nifti files was failing due to a bug. It was written for a single extension given as str, not a list
  • Loading branch information
gurayerus authored Oct 10, 2024
1 parent 6ad18aa commit edada14
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions NiChart_DLMUSE/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,14 @@ def make_img_list(in_data: str) -> pd.DataFrame:
else:
with open(in_data, "r") as file:
lines = file.readlines()
nii_files = [
os.path.abspath(line.strip())
for line in lines
if line.strip().endswith(LIST_IMG_EXT) # type:ignore
]
nii_files = []
for line in lines:
is_nifti = False
for tmp_ext in LIST_IMG_EXT:
if line.strip().endswith(tmp_ext):
is_nifti = True
if is_nifti == True:
nii_files.append(os.path.abspath(line.strip()))

nii_files = np.array(nii_files)
print(f"Detected {nii_files.shape[0]} images ...") # type:ignore
Expand Down

0 comments on commit edada14

Please sign in to comment.