Skip to content

Commit

Permalink
Adding the option to compress the sessions folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasser Alemán Gómez committed May 25, 2024
1 parent 6dc1200 commit 3659566
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions clabtoolkit/dicomtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ def _org_conv_dicoms(in_dic_dir: str,
"""
nthreads = os.cpu_count()

# Output directories
dicomDir = os.path.join(out_dic_dir, 'Dicom')

# Listing the subject ids inside the dicom folder
my_list = os.listdir(in_dic_dir)
subj_ids = []
for it in my_list:
Expand Down Expand Up @@ -137,7 +135,7 @@ def _org_conv_dicoms(in_dic_dir: str,
# results = list(executor.map(_copy_dicom_file, dicom_files,
# [subj_id] * ndwis, [out_dic_dir] * ndwis, [ses_id] * ndwis, [date_times] * ndwis, [demobool] * ndwis, [subTB] * ndwis, [boolforce] * ndwis))

t1 = pb.add_task(f'[red]Copying DICOMs: Subject {cont_subj + 1}/{n_subj} ', total=ndics)
t1 = pb.add_task(f'[red]Copying DICOMs: Subject {subj_id} ({cont_subj + 1}/{n_subj}) ', total=ndics)

for cont_dic, dfiles in enumerate(dicom_files):
ser_dir = _copy_dicom_file(dfiles, subj_id, out_dic_dir, ses_id, date_times, demobool, subTB, boolforce)
Expand Down Expand Up @@ -175,6 +173,9 @@ def _org_conv_dicoms(in_dic_dir: str,

all_ser_dirs = list(set(all_ser_dirs))
all_ser_dirs.sort()

if boolcomp:
_compress_dicom_session(out_dic_dir)


def _copy_dicom_file(dic_file: str,
Expand Down

0 comments on commit 3659566

Please sign in to comment.