diff --git a/xnat2mids/__main__.py b/xnat2mids/__main__.py index 99d28eb..200ee6b 100644 --- a/xnat2mids/__main__.py +++ b/xnat2mids/__main__.py @@ -39,23 +39,7 @@ This application allow the user to download one project on XNAT and transform this project in MIDS format - There are 2 functions in this code: - download one project from xnat application: - arguments: - Prefix -w --web PAGE_WEB 1) The URL page where XNAT is. - Prefix -p --project [PROJECTS] 2) The project name to download - Prefix -i --input PATH 3) the directory where the files - will be downloaded - Prefix -u --user [USER] 4) The username to login in XNAT - If not write a username, It - loggin as guest. - - Convert the xnat directories of the project in MIDS format: - arguments: - Prefix -i --input PATH 1) the directory where the files will - be downloaded - Prefix -o --output PATH 2) Directory where the MIDS model - is applied. + """ ############################################################################### # Imports @@ -93,49 +77,9 @@ def main(): This sorfware allows the user to Download one project into XNAT platform and convert the XNAT images directory in MIDS directory. - The aplication execution needs Python --version >= 3.5. - - there are 2 functions in this code: - - Download temporary projects from xnat application: - - arguments: - + Prefix -w --web PAGE_WEB 1) The URL page where XNAT is. - - + Prefix -u --user [USER] 2) The username to login in XNAT - If not write a username, It logins - as guest. - - + Prefix -i --input INPUT 4) The directory where the - files will be downloaded. - - + Prefix -t --types [sdnbr] 5) Download types of MRI images - included in xnat - - d = dicom + dicom metadata in - folder NIFTI - - n = nifti or png if image is - one slide (2D) + roi - - b = BIDS (only in CENTRAL XNAT) - - r = Structural report - default = nr + The aplication execution needs Python --version >= 3.6.7 - - + Prefix --overwrite 5) Overwrite download files - - - Convert the xnat directories of the project in MIDS format: - - arguments: - - + Prefix -i --input INPUT 1) The directory where the files - will be downloaded. - - + Prefix -o --output OUTPUT 2) Directory where the MIDS model - is applied. - + Prefix -bp --body-part 3) Specify which part of the body are - in the dataset(A clear dataset with - only one part are needed) - """ + """ ) parser.add_argument('-w', '--web', type=str, default=None, help='The URL page where XNAT is.') diff --git a/xnat2mids/mids_conversion.py b/xnat2mids/mids_conversion.py index 27cac81..e65b3b9 100644 --- a/xnat2mids/mids_conversion.py +++ b/xnat2mids/mids_conversion.py @@ -112,7 +112,7 @@ def create_directory_mids_v1(xnat_data_path, mids_data_path, body_part): mids_session_path = mids_data_path.joinpath(subject_name, session_name) xml_session_rois = list(sessions_xnat_path.rglob('*.xml')) - #print(f"1: {mids_session_path=}") + #print(f"1: {mids_session_path}") tagger = Tagger() tagger.load_table_protocol( './xnat2mids/protocols/protocol_RM_brain.tsv' @@ -162,8 +162,8 @@ def create_directory_mids_v1(xnat_data_path, mids_data_path, body_part): " # print() # print(modality, study_description, ProtocolName, image_type) - print(f"{study_description=}") - print(f"{Protocol_name=}") + print(f"{study_description}") + print(f"{Protocol_name}") if modality == "MR": # via BIDS protocols #if study_description in LUMBAR_PROTOCOLS_ACEPTED: diff --git a/xnat2mids/procedures/light_procedures.py b/xnat2mids/procedures/light_procedures.py index 86486fb..6411cbc 100644 --- a/xnat2mids/procedures/light_procedures.py +++ b/xnat2mids/procedures/light_procedures.py @@ -34,7 +34,7 @@ def copy_sessions(self, subject_name): df_aux.index = numpy.arange(1, len(df_aux) + 1) print(len(df_aux)) activate_run = True if len(df_aux) > 1 else False - print(f"{activate_run=}") + print(f"{activate_run}") for index, row in df_aux.iterrows(): activate_acq_partioned = True if len(row['run']) > 1 else False for acq, file_ in enumerate(sorted(row['run'])): @@ -64,7 +64,7 @@ def calculate_name(self, subject_name, key, num_run, num_part, activate_run, act rec = f"{key_list[1] if key_list[1] else ''}" chunk = f"{num_part if activate_acq_partioned else ''}" run = f"{num_run if activate_run else ''}" - print(f"{run=}") + print(f"{run}") # print(f"{key=}") return "_".join([ part for part in [ diff --git a/xnat2mids/procedures/magnetic_resonance_procedures.py b/xnat2mids/procedures/magnetic_resonance_procedures.py index de9d360..b230f79 100644 --- a/xnat2mids/procedures/magnetic_resonance_procedures.py +++ b/xnat2mids/procedures/magnetic_resonance_procedures.py @@ -24,7 +24,7 @@ def control_sequences( "" if body_part.lower() in body_part_bids else "mim-mr", folder_BIDS ) - print(f'{folder_image_mids=}') + print(f'{folder_image_mids}') folder_image_mids.mkdir(parents=True, exist_ok=True) @@ -103,7 +103,7 @@ def calculate_name(self, subject_name, keys, num_run, num_part, activate_run, ac print(num_part, activate_acq_partioned) acq = f"{keys[1] if keys[1] else ''}" chunk = f"{num_part if activate_acq_partioned else ''}" - print(f"{keys=}") + print(f"{keys}") return "_".join([ part for part in [ subject_name, diff --git a/xnat2mids/protocols/scans_tagger.py b/xnat2mids/protocols/scans_tagger.py index 9d1c2d1..ddb82a3 100644 --- a/xnat2mids/protocols/scans_tagger.py +++ b/xnat2mids/protocols/scans_tagger.py @@ -29,10 +29,10 @@ def classification_by_min_max(self, dict_atrubutes): image_type = dict_atrubutes["ImageType"] #sequence_name = dict_atrubutes["SequenceName"] #image_type = dict_atrubutes["ImageType"] - print(f"{scaning_sequence=:}") - print(f"{sequence_variant=:}") - print(f"{scan_options=:}") - print(f"{image_type=}") + print(f"{scaning_sequence}") + print(f"{sequence_variant}") + print(f"{scan_options}") + print(f"{image_type}") #scaning_sequence = scaning_sequence if type(scaning_sequence) is str else "\\".join(scaning_sequence) table_protocol_SS = self.table_protocols[[ diff --git a/xnat2mids/requirements.txt b/xnat2mids/requirements.txt index 8e4d1da..e8c7fa7 100644 --- a/xnat2mids/requirements.txt +++ b/xnat2mids/requirements.txt @@ -1,62 +1,21 @@ -absl-py==1.0.0 -astunparse==1.6.3 -async-timeout==4.0.2 -beautifulsoup4==4.11.1 -bs4==0.0.1 -cachetools==5.1.0 -certifi==2021.10.8 -chardet==4.0.0 +certifi==2021.5.30 charset-normalizer==2.0.12 -Deprecated==1.2.13 -flatbuffers==2.0 -gast==0.5.3 -google-auth==2.6.6 -google-auth-oauthlib==0.4.6 -google-pasta==0.2.0 -grpcio==1.46.1 -h5py==3.6.0 -idna==3.3 -imageio==2.19.1 -keras==2.8.0 -Keras-Preprocessing==1.1.2 -libclang==14.0.1 -lxml==4.8.0 -Markdown==3.3.7 -networkx==2.8 +idna==3.4 +importlib-resources==5.4.0 nibabel==3.2.2 -npyscreen==4.10.5 -numpy==1.22.3 -oauthlib==3.2.0 -opt-einsum==3.3.0 +numpy==1.19.5 packaging==21.3 -pandas==1.4.2 -Pillow==9.1.0 -progressbar2==4.0.0 -protobuf==3.20.1 -pyasn1==0.4.8 -pyasn1-modules==0.2.8 -pydicom==2.3.0 -pyparsing==3.0.8 +pandas==1.1.5 +progressbar2==3.55.0 +pydicom==2.3.1 +pyparsing==3.0.9 python-dateutil==2.8.2 -python-utils==3.1.0 -pytz==2022.1 -PyWavelets==1.3.0 -redis==4.3.0 +python-utils==3.5.2 +pytz==2023.3 requests==2.27.1 -requests-oauthlib==1.3.1 -rsa==4.8 -scikit-image==0.19.2 -scipy==1.8.0 +SimpleITK==2.1.1.2 six==1.16.0 -soupsieve==2.3.2.post1 -tensorboard==2.8.0 -tensorboard-data-server==0.6.1 -tensorboard-plugin-wit==1.8.1 -tensorflow==2.8.0 -tensorflow-io-gcs-filesystem==0.25.0 -termcolor==1.1.0 -tf-estimator-nightly==2.8.0.dev2021122109 -typing-extensions==4.2.0 -urllib3==1.26.9 -Werkzeug==2.1.2 -wrapt==1.14.1 +tqdm==4.64.1 +typing_extensions==4.1.1 +urllib3==1.26.16 +zipp==3.6.0