From a1ccf2480a7c5751319785090c374117a848bba4 Mon Sep 17 00:00:00 2001 From: Fidel Alfaro Almagro <falmagro@fmrib.ox.ac.uk> Date: Fri, 10 Feb 2023 07:45:50 +0000 Subject: [PATCH] Restructuring project --- bip/main.py | 2 +- bip/pipelines/dMRI_diff/dMRI_diff.py | 2 +- bip/pipelines/dMRI_diff/diff_autoptx.py | 2 +- bip/pipelines/dMRI_diff/diff_bedpostx.py | 2 +- bip/pipelines/dMRI_diff/diff_dtifit.py | 2 +- bip/pipelines/dMRI_diff/diff_eddy.py | 2 +- bip/pipelines/dMRI_diff/diff_noddi.py | 2 +- bip/pipelines/dMRI_diff/diff_tbss.py | 2 +- bip/pipelines/dMRI_fieldmap/dMRI_fieldmap.py | 2 +- bip/pipelines/dMRI_fieldmap/fieldmap_post_topup.py | 2 +- bip/pipelines/dMRI_fieldmap/fieldmap_pre_topup.py | 11 ++++++----- bip/pipelines/dMRI_fieldmap/fieldmap_topup.py | 2 +- bip/pipelines/fMRI_rest/fMRI_rest.py | 2 +- bip/pipelines/fMRI_rest/rfMRI_fix.py | 2 +- bip/pipelines/fMRI_rest/rfMRI_melodic.py | 2 +- bip/pipelines/fMRI_rest/rfMRI_netmats.py | 2 +- bip/pipelines/fMRI_rest/rfMRI_prepare.py | 6 +++--- bip/pipelines/fMRI_task/fMRI_task.py | 2 +- bip/pipelines/fMRI_task/tfMRI_feat.py | 2 +- bip/pipelines/fMRI_task/tfMRI_prepare.py | 6 +++--- bip/pipelines/struct_FS/FS_get_IDPs.py | 2 +- bip/pipelines/struct_FS/FS_proc.py | 3 +-- bip/pipelines/struct_FS/FS_segm.py | 4 ++-- bip/pipelines/struct_FS/struct_FS.py | 2 +- bip/pipelines/struct_T1/T1_QC_CNR_corners.py | 2 +- bip/pipelines/struct_T1/T1_QC_CNR_eyes.py | 2 +- bip/pipelines/struct_T1/T1_QC_COG.py | 2 +- bip/pipelines/struct_T1/T1_brain_extract.py | 2 +- bip/pipelines/struct_T1/T1_defacing.py | 2 +- bip/pipelines/struct_T1/T1_fast.py | 2 +- bip/pipelines/struct_T1/T1_first.py | 2 +- bip/pipelines/struct_T1/T1_gdc.py | 2 +- bip/pipelines/struct_T1/T1_sienax.py | 2 +- bip/pipelines/struct_T1/struct_T1.py | 2 +- bip/pipelines/struct_T2_FLAIR/T2_FLAIR_apply_bfc.py | 2 +- .../struct_T2_FLAIR/T2_FLAIR_brain_extract.py | 2 +- bip/pipelines/struct_T2_FLAIR/T2_FLAIR_defacing.py | 2 +- bip/pipelines/struct_T2_FLAIR/T2_FLAIR_gdc.py | 2 +- bip/pipelines/struct_T2_FLAIR/struct_T2_FLAIR.py | 2 +- bip/pipelines/struct_asl/asl_get_IDPs.py | 2 +- bip/pipelines/struct_asl/asl_proc.py | 4 ++-- bip/pipelines/struct_asl/struct_asl.py | 2 +- bip/pipelines/struct_swMRI/struct_swMRI.py | 2 +- bip/pipelines/struct_swMRI/swMRI_gdc.py | 2 +- bip/pipelines/struct_swMRI/swMRI_proc.py | 2 +- bip/pipelines/struct_swMRI/swMRI_proc_fnc.py | 2 +- bip/{commands => utils}/__init__.py | 0 bip/{commands => utils}/get_b0s.py | 0 bip/{commands => utils}/get_dwell_time.py | 4 ++-- bip/{utils.py => utils/log_utils.py} | 0 bip/{commands => utils}/read_json_field.py | 0 51 files changed, 59 insertions(+), 59 deletions(-) rename bip/{commands => utils}/__init__.py (100%) rename bip/{commands => utils}/get_b0s.py (100%) rename bip/{commands => utils}/get_dwell_time.py (89%) rename bip/{utils.py => utils/log_utils.py} (100%) rename bip/{commands => utils}/read_json_field.py (100%) diff --git a/bip/main.py b/bip/main.py index cea402e..c0dc387 100755 --- a/bip/main.py +++ b/bip/main.py @@ -16,7 +16,7 @@ from dataclasses import dataclass, field from file_tree import FileTree from pipe_tree import Pipeline, Ref import bip -from bip.utils import setup_logging +from bip.utils.log_utils import setup_logging from bip.pipelines.struct_T1 import struct_T1 from bip.pipelines.struct_T2_FLAIR import struct_T2_FLAIR from bip.pipelines.struct_FS import struct_FS diff --git a/bip/pipelines/dMRI_diff/dMRI_diff.py b/bip/pipelines/dMRI_diff/dMRI_diff.py index 4863366..d213583 100755 --- a/bip/pipelines/dMRI_diff/dMRI_diff.py +++ b/bip/pipelines/dMRI_diff/dMRI_diff.py @@ -10,7 +10,7 @@ # import logging -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from bip.pipelines.dMRI_diff import diff_eddy from bip.pipelines.dMRI_diff import diff_dtifit from bip.pipelines.dMRI_diff import diff_noddi diff --git a/bip/pipelines/dMRI_diff/diff_autoptx.py b/bip/pipelines/dMRI_diff/diff_autoptx.py index 1255756..894dc2d 100755 --- a/bip/pipelines/dMRI_diff/diff_autoptx.py +++ b/bip/pipelines/dMRI_diff/diff_autoptx.py @@ -15,7 +15,7 @@ import random import logging from shutil import copyfile from fsl import wrappers -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from pipe_tree import In, Out, Ref, Var log = logging.getLogger(__name__) diff --git a/bip/pipelines/dMRI_diff/diff_bedpostx.py b/bip/pipelines/dMRI_diff/diff_bedpostx.py index d8e5acd..3cf8ace 100755 --- a/bip/pipelines/dMRI_diff/diff_bedpostx.py +++ b/bip/pipelines/dMRI_diff/diff_bedpostx.py @@ -14,7 +14,7 @@ import os import logging from shutil import copyfile from fsl import wrappers -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from pipe_tree import In, Out, Ref log = logging.getLogger(__name__) diff --git a/bip/pipelines/dMRI_diff/diff_dtifit.py b/bip/pipelines/dMRI_diff/diff_dtifit.py index 1b7b8c6..43c6e6c 100755 --- a/bip/pipelines/dMRI_diff/diff_dtifit.py +++ b/bip/pipelines/dMRI_diff/diff_dtifit.py @@ -14,7 +14,7 @@ import logging from shutil import copyfile import numpy as np from fsl import wrappers -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from pipe_tree import In, Out, Ref from gradunwarp.core.gradient_unwarp_apply import gradient_unwarp_apply diff --git a/bip/pipelines/dMRI_diff/diff_eddy.py b/bip/pipelines/dMRI_diff/diff_eddy.py index 9c710b2..ae947ca 100755 --- a/bip/pipelines/dMRI_diff/diff_eddy.py +++ b/bip/pipelines/dMRI_diff/diff_eddy.py @@ -15,7 +15,7 @@ import logging from shutil import copyfile import nibabel as nib from fsl import wrappers -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from pipe_tree import In, Out, Ref log = logging.getLogger(__name__) diff --git a/bip/pipelines/dMRI_diff/diff_noddi.py b/bip/pipelines/dMRI_diff/diff_noddi.py index a7252ec..8d36809 100755 --- a/bip/pipelines/dMRI_diff/diff_noddi.py +++ b/bip/pipelines/dMRI_diff/diff_noddi.py @@ -16,7 +16,7 @@ import zipfile import gzip import shutil import amico -from bip.utils import redirect_logging, tempdir +from bip.utils.log_utils import redirect_logging, tempdir from pipe_tree import In, Out, Ref diff --git a/bip/pipelines/dMRI_diff/diff_tbss.py b/bip/pipelines/dMRI_diff/diff_tbss.py index f490e92..04c5482 100755 --- a/bip/pipelines/dMRI_diff/diff_tbss.py +++ b/bip/pipelines/dMRI_diff/diff_tbss.py @@ -15,7 +15,7 @@ import logging from shutil import copyfile import nibabel as nib from fsl import wrappers -from bip.utils import redirect_logging, tempdir +from bip.utils.log_utils import redirect_logging, tempdir from pipe_tree import In, Out, Ref log = logging.getLogger(__name__) diff --git a/bip/pipelines/dMRI_fieldmap/dMRI_fieldmap.py b/bip/pipelines/dMRI_fieldmap/dMRI_fieldmap.py index d320f01..22470f9 100644 --- a/bip/pipelines/dMRI_fieldmap/dMRI_fieldmap.py +++ b/bip/pipelines/dMRI_fieldmap/dMRI_fieldmap.py @@ -10,7 +10,7 @@ # import logging -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from bip.pipelines.dMRI_fieldmap import fieldmap_pre_topup from bip.pipelines.dMRI_fieldmap import fieldmap_topup from bip.pipelines.dMRI_fieldmap import fieldmap_post_topup diff --git a/bip/pipelines/dMRI_fieldmap/fieldmap_post_topup.py b/bip/pipelines/dMRI_fieldmap/fieldmap_post_topup.py index 4e1bfdb..cef087b 100755 --- a/bip/pipelines/dMRI_fieldmap/fieldmap_post_topup.py +++ b/bip/pipelines/dMRI_fieldmap/fieldmap_post_topup.py @@ -14,7 +14,7 @@ from shutil import copyfile import numpy as np import nibabel as nib from fsl import wrappers -from bip.utils import redirect_logging, tempdir +from bip.utils.log_utils import redirect_logging, tempdir from pipe_tree import In, Out, Ref from gradunwarp.core.gradient_unwarp_apply import gradient_unwarp_apply diff --git a/bip/pipelines/dMRI_fieldmap/fieldmap_pre_topup.py b/bip/pipelines/dMRI_fieldmap/fieldmap_pre_topup.py index ab472fe..f6b2084 100755 --- a/bip/pipelines/dMRI_fieldmap/fieldmap_pre_topup.py +++ b/bip/pipelines/dMRI_fieldmap/fieldmap_pre_topup.py @@ -16,9 +16,10 @@ from shutil import copyfile import numpy as np import nibabel as nib from fsl import wrappers -from bip.utils import redirect_logging, tempdir -from bip.commands import get_b0s, get_dwell_time -from bip.commands.read_json_field import read_json_field +from bip.utils.log_utils import redirect_logging, tempdir +from bip.utils.get_b0s import get_b0s +from bip.utils.get_dwell_time import get_dwell_time +from bip.utils.read_json_field import read_json_field from pipe_tree import In, Out, Ref @@ -39,7 +40,7 @@ def choose_best_B0(ctx, img, bval, total_B0, indices, tmp, best_index, B0, else: num_vols = len(np.where(bvals <= b0_threshold)[0]) - get_b0s.get_b0s(img, bval, total_B0, indices, num_vols, b0_threshold) + get_b0s(img, bval, total_B0, indices, num_vols, b0_threshold) ind_values = [int(x) for x in np.loadtxt(indices)] wrappers.fslsplit(total_B0, tmp) @@ -142,7 +143,7 @@ def generate_acqparams(AP, PA, AP_json, PA_json, numAP, numPA, acqparams): imAP = nib.load(AP) numlines = imAP.header['dim'][dim_AP] - dtiDwell = get_dwell_time.get_dt(AP, AP_json) + dtiDwell = get_dwell_time(AP, AP_json) topupValue = (dtiDwell * (numlines -1)) / 1000.0 diff --git a/bip/pipelines/dMRI_fieldmap/fieldmap_topup.py b/bip/pipelines/dMRI_fieldmap/fieldmap_topup.py index 15bf030..f06c097 100755 --- a/bip/pipelines/dMRI_fieldmap/fieldmap_topup.py +++ b/bip/pipelines/dMRI_fieldmap/fieldmap_topup.py @@ -12,7 +12,7 @@ import logging from fsl import wrappers -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from pipe_tree import In, Out, Ref log = logging.getLogger(__name__) diff --git a/bip/pipelines/fMRI_rest/fMRI_rest.py b/bip/pipelines/fMRI_rest/fMRI_rest.py index 3c1238e..2878a7b 100755 --- a/bip/pipelines/fMRI_rest/fMRI_rest.py +++ b/bip/pipelines/fMRI_rest/fMRI_rest.py @@ -10,7 +10,7 @@ # import logging -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from bip.pipelines.fMRI_rest import rfMRI_prepare from bip.pipelines.fMRI_rest import rfMRI_melodic from bip.pipelines.fMRI_rest import rfMRI_fix diff --git a/bip/pipelines/fMRI_rest/rfMRI_fix.py b/bip/pipelines/fMRI_rest/rfMRI_fix.py index 9899d50..6248401 100755 --- a/bip/pipelines/fMRI_rest/rfMRI_fix.py +++ b/bip/pipelines/fMRI_rest/rfMRI_fix.py @@ -14,7 +14,7 @@ import logging from shutil import copyfile from pipe_tree import In, Out, Ref from fsl import wrappers -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from pyfix import extract, legacy, io, clean, classify log = logging.getLogger(__name__) diff --git a/bip/pipelines/fMRI_rest/rfMRI_melodic.py b/bip/pipelines/fMRI_rest/rfMRI_melodic.py index b38b69d..6e6c3b9 100755 --- a/bip/pipelines/fMRI_rest/rfMRI_melodic.py +++ b/bip/pipelines/fMRI_rest/rfMRI_melodic.py @@ -15,7 +15,7 @@ import os import shutil import logging from fsl import wrappers -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from pipe_tree import In, Out, Ref log = logging.getLogger(__name__) diff --git a/bip/pipelines/fMRI_rest/rfMRI_netmats.py b/bip/pipelines/fMRI_rest/rfMRI_netmats.py index 9419385..c110d3d 100755 --- a/bip/pipelines/fMRI_rest/rfMRI_netmats.py +++ b/bip/pipelines/fMRI_rest/rfMRI_netmats.py @@ -13,7 +13,7 @@ import os import logging from fsl import wrappers from pipe_tree import In, Out, Ref, Var -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from bip.pipelines.fMRI_rest.rfMRI_netmats_fnc import ICA_dr log = logging.getLogger(__name__) diff --git a/bip/pipelines/fMRI_rest/rfMRI_prepare.py b/bip/pipelines/fMRI_rest/rfMRI_prepare.py index f496829..8af1d40 100755 --- a/bip/pipelines/fMRI_rest/rfMRI_prepare.py +++ b/bip/pipelines/fMRI_rest/rfMRI_prepare.py @@ -16,8 +16,8 @@ from shutil import copyfile import nibabel as nib from pipe_tree import In, Out, Ref from fsl import wrappers -from bip.commands import get_dwell_time -from bip.utils import redirect_logging +from bip.utils.get_dwell_time import get_dwell_time +from bip.utils.log_utils import redirect_logging from gradunwarp.core.gradient_unwarp_apply import gradient_unwarp_apply log = logging.getLogger(__name__) @@ -70,7 +70,7 @@ def run(ctx, fMRI_img = nib.load(rfMRI) fmriNumVol = fMRI_img.header['dim'][4] fmriTR = fMRI_img.header['pixdim'][4] - fmriDwell = get_dwell_time.get_dt(rfMRI, rfMRI_json) + fmriDwell = get_dwell_time(rfMRI, rfMRI_json) fmriTE = 39 # Default value for task fMRI TE descrip = str(fMRI_img.header['descrip']) diff --git a/bip/pipelines/fMRI_task/fMRI_task.py b/bip/pipelines/fMRI_task/fMRI_task.py index f30fd94..120ebe4 100755 --- a/bip/pipelines/fMRI_task/fMRI_task.py +++ b/bip/pipelines/fMRI_task/fMRI_task.py @@ -10,7 +10,7 @@ # import logging -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from bip.pipelines.fMRI_task import tfMRI_prepare from bip.pipelines.fMRI_task import tfMRI_feat diff --git a/bip/pipelines/fMRI_task/tfMRI_feat.py b/bip/pipelines/fMRI_task/tfMRI_feat.py index 54706af..0c58b83 100755 --- a/bip/pipelines/fMRI_task/tfMRI_feat.py +++ b/bip/pipelines/fMRI_task/tfMRI_feat.py @@ -12,7 +12,7 @@ import logging from fsl import wrappers -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from pipe_tree import In, Out, Ref log = logging.getLogger(__name__) diff --git a/bip/pipelines/fMRI_task/tfMRI_prepare.py b/bip/pipelines/fMRI_task/tfMRI_prepare.py index 3eef64b..06bc292 100755 --- a/bip/pipelines/fMRI_task/tfMRI_prepare.py +++ b/bip/pipelines/fMRI_task/tfMRI_prepare.py @@ -16,8 +16,8 @@ from shutil import copyfile import nibabel as nib from pipe_tree import In, Out, Ref from fsl import wrappers -from bip.commands import get_dwell_time -from bip.utils import redirect_logging +from bip.utils.get_dwell_time import get_dwell_time +from bip.utils.log_utils import redirect_logging from gradunwarp.core.gradient_unwarp_apply import gradient_unwarp_apply log = logging.getLogger(__name__) @@ -69,7 +69,7 @@ def run(ctx, fMRI_img = nib.load(tfMRI) fmriNumVol = fMRI_img.header['dim'][4] fmriTR = fMRI_img.header['pixdim'][4] - fmriDwell = get_dwell_time.get_dt(tfMRI, tfMRI_json) + fmriDwell = get_dwell_time(tfMRI, tfMRI_json) fmriTE = 39 # Default value for task fMRI TE descrip = str(fMRI_img.header['descrip']) diff --git a/bip/pipelines/struct_FS/FS_get_IDPs.py b/bip/pipelines/struct_FS/FS_get_IDPs.py index 4d19117..361e250 100755 --- a/bip/pipelines/struct_FS/FS_get_IDPs.py +++ b/bip/pipelines/struct_FS/FS_get_IDPs.py @@ -12,7 +12,7 @@ import logging from pipe_tree import In, Out, Ref -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_FS/FS_proc.py b/bip/pipelines/struct_FS/FS_proc.py index 6a654e9..28f2396 100755 --- a/bip/pipelines/struct_FS/FS_proc.py +++ b/bip/pipelines/struct_FS/FS_proc.py @@ -15,8 +15,7 @@ import shutil import logging import subprocess from pipe_tree import In, Out, Ref -#from bip import ext_wrappers -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_FS/FS_segm.py b/bip/pipelines/struct_FS/FS_segm.py index 94d3361..ae59e4e 100755 --- a/bip/pipelines/struct_FS/FS_segm.py +++ b/bip/pipelines/struct_FS/FS_segm.py @@ -17,8 +17,8 @@ from shutil import copyfile from fsl import wrappers from pipe_tree import In, Out, Ref from gradunwarp.core.gradient_unwarp_apply import gradient_unwarp_apply -from bip.utils import redirect_logging -from bip.commands.bb_read_json_field import bb_read_json_field +from bip.utils.log_utils import redirect_logging +from bip.utils.read_json_field import read_json_field log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_FS/struct_FS.py b/bip/pipelines/struct_FS/struct_FS.py index a3df06c..79613a5 100755 --- a/bip/pipelines/struct_FS/struct_FS.py +++ b/bip/pipelines/struct_FS/struct_FS.py @@ -10,7 +10,7 @@ # import logging -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from bip.pipelines.struct_FS import FS_proc#, FS_segm, FS_get_IDPs log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T1/T1_QC_CNR_corners.py b/bip/pipelines/struct_T1/T1_QC_CNR_corners.py index fee0701..aa1144a 100755 --- a/bip/pipelines/struct_T1/T1_QC_CNR_corners.py +++ b/bip/pipelines/struct_T1/T1_QC_CNR_corners.py @@ -13,7 +13,7 @@ import logging from fsl import wrappers from pipe_tree import In, Out, Ref -from bip.utils import redirect_logging, tempdir +from bip.utils.log_utils import redirect_logging, tempdir log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T1/T1_QC_CNR_eyes.py b/bip/pipelines/struct_T1/T1_QC_CNR_eyes.py index 5bc8dfb..d4a3eab 100755 --- a/bip/pipelines/struct_T1/T1_QC_CNR_eyes.py +++ b/bip/pipelines/struct_T1/T1_QC_CNR_eyes.py @@ -16,7 +16,7 @@ import logging import nibabel as nib from fsl import wrappers from pipe_tree import In, Out, Ref -from bip.utils import redirect_logging, tempdir +from bip.utils.log_utils import redirect_logging, tempdir log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T1/T1_QC_COG.py b/bip/pipelines/struct_T1/T1_QC_COG.py index 5d4ea84..3e48b4e 100755 --- a/bip/pipelines/struct_T1/T1_QC_COG.py +++ b/bip/pipelines/struct_T1/T1_QC_COG.py @@ -13,7 +13,7 @@ import logging import numpy as np import nibabel as nib from fsl import wrappers -from bip.utils import redirect_logging, tempdir +from bip.utils.log_utils import redirect_logging, tempdir from pipe_tree import In, Out, Ref log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T1/T1_brain_extract.py b/bip/pipelines/struct_T1/T1_brain_extract.py index 221507a..57d545e 100755 --- a/bip/pipelines/struct_T1/T1_brain_extract.py +++ b/bip/pipelines/struct_T1/T1_brain_extract.py @@ -14,7 +14,7 @@ import logging from shutil import copyfile from fsl import wrappers -from bip.utils import redirect_logging, tempdir +from bip.utils.log_utils import redirect_logging, tempdir from pipe_tree import In, Out, Ref, update_closure log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T1/T1_defacing.py b/bip/pipelines/struct_T1/T1_defacing.py index ff1ff7f..67a38c1 100755 --- a/bip/pipelines/struct_T1/T1_defacing.py +++ b/bip/pipelines/struct_T1/T1_defacing.py @@ -12,7 +12,7 @@ import logging from fsl import wrappers from pipe_tree import In, Out, Ref -from bip.utils import redirect_logging, tempdir +from bip.utils.log_utils import redirect_logging, tempdir log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T1/T1_fast.py b/bip/pipelines/struct_T1/T1_fast.py index c912330..2bccfee 100755 --- a/bip/pipelines/struct_T1/T1_fast.py +++ b/bip/pipelines/struct_T1/T1_fast.py @@ -12,7 +12,7 @@ import logging from fsl import wrappers -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from pipe_tree import In, Out, Ref, update_closure log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T1/T1_first.py b/bip/pipelines/struct_T1/T1_first.py index 02729a4..8b1ca75 100755 --- a/bip/pipelines/struct_T1/T1_first.py +++ b/bip/pipelines/struct_T1/T1_first.py @@ -15,7 +15,7 @@ import glob import logging from pipe_tree import In, Out, Ref from fsl import wrappers -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T1/T1_gdc.py b/bip/pipelines/struct_T1/T1_gdc.py index bf8f7e4..35cc6bd 100755 --- a/bip/pipelines/struct_T1/T1_gdc.py +++ b/bip/pipelines/struct_T1/T1_gdc.py @@ -12,7 +12,7 @@ import logging from shutil import copyfile from pipe_tree import In, Out, Ref -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from gradunwarp.core.gradient_unwarp_apply import gradient_unwarp_apply log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T1/T1_sienax.py b/bip/pipelines/struct_T1/T1_sienax.py index e875933..ba31328 100755 --- a/bip/pipelines/struct_T1/T1_sienax.py +++ b/bip/pipelines/struct_T1/T1_sienax.py @@ -13,7 +13,7 @@ import os import logging from fsl import wrappers from fsl.transform import affine, flirt -from bip.utils import redirect_logging, tempdir +from bip.utils.log_utils import redirect_logging, tempdir from pipe_tree import In, Out, Ref log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T1/struct_T1.py b/bip/pipelines/struct_T1/struct_T1.py index c9138cc..438744c 100755 --- a/bip/pipelines/struct_T1/struct_T1.py +++ b/bip/pipelines/struct_T1/struct_T1.py @@ -10,7 +10,7 @@ # import logging -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from bip.pipelines.struct_T1 import T1_gdc, T1_brain_extract, T1_defacing from bip.pipelines.struct_T1 import T1_fast, T1_first, T1_sienax, T1_QC_COG from bip.pipelines.struct_T1 import T1_QC_CNR_corners, T1_QC_CNR_eyes diff --git a/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_apply_bfc.py b/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_apply_bfc.py index c9509a9..5c80b1d 100755 --- a/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_apply_bfc.py +++ b/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_apply_bfc.py @@ -14,7 +14,7 @@ import os import logging from fsl import wrappers -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from pipe_tree import In, Out, Ref log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_brain_extract.py b/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_brain_extract.py index 2264699..a9a1aba 100755 --- a/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_brain_extract.py +++ b/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_brain_extract.py @@ -12,7 +12,7 @@ import logging from shutil import copyfile from fsl import wrappers -from bip.utils import redirect_logging, tempdir +from bip.utils.log_utils import redirect_logging, tempdir from pipe_tree import In, Out, Ref, update_closure log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_defacing.py b/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_defacing.py index bd4d8ed..aa64af2 100755 --- a/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_defacing.py +++ b/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_defacing.py @@ -15,7 +15,7 @@ import logging from shutil import copyfile from fsl import wrappers from pipe_tree import In, Out, Ref -from bip.utils import redirect_logging, tempdir +from bip.utils.log_utils import redirect_logging, tempdir log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_gdc.py b/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_gdc.py index b3f00d7..d772bd1 100755 --- a/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_gdc.py +++ b/bip/pipelines/struct_T2_FLAIR/T2_FLAIR_gdc.py @@ -13,7 +13,7 @@ import logging from shutil import copyfile from pipe_tree import In, Out, Ref -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from gradunwarp.core.gradient_unwarp_apply import gradient_unwarp_apply log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_T2_FLAIR/struct_T2_FLAIR.py b/bip/pipelines/struct_T2_FLAIR/struct_T2_FLAIR.py index 2c08a11..b052870 100755 --- a/bip/pipelines/struct_T2_FLAIR/struct_T2_FLAIR.py +++ b/bip/pipelines/struct_T2_FLAIR/struct_T2_FLAIR.py @@ -10,7 +10,7 @@ # import logging -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from bip.pipelines.struct_T2_FLAIR import T2_FLAIR_gdc, T2_FLAIR_brain_extract from bip.pipelines.struct_T2_FLAIR import T2_FLAIR_defacing, T2_FLAIR_apply_bfc diff --git a/bip/pipelines/struct_asl/asl_get_IDPs.py b/bip/pipelines/struct_asl/asl_get_IDPs.py index 4d19117..361e250 100755 --- a/bip/pipelines/struct_asl/asl_get_IDPs.py +++ b/bip/pipelines/struct_asl/asl_get_IDPs.py @@ -12,7 +12,7 @@ import logging from pipe_tree import In, Out, Ref -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_asl/asl_proc.py b/bip/pipelines/struct_asl/asl_proc.py index 864629e..c6eebed 100755 --- a/bip/pipelines/struct_asl/asl_proc.py +++ b/bip/pipelines/struct_asl/asl_proc.py @@ -17,8 +17,8 @@ from shutil import copyfile from fsl import wrappers from pipe_tree import In, Out, Ref from gradunwarp.core.gradient_unwarp_apply import gradient_unwarp_apply -from bip.utils import redirect_logging -from bip.commands.read_json_field import read_json_field +from bip.utils.log_utils import redirect_logging +from bip.utils.read_json_field import read_json_field log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_asl/struct_asl.py b/bip/pipelines/struct_asl/struct_asl.py index 2a591ae..9814e7d 100755 --- a/bip/pipelines/struct_asl/struct_asl.py +++ b/bip/pipelines/struct_asl/struct_asl.py @@ -10,7 +10,7 @@ # import logging -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from bip.pipelines.struct_asl import asl_proc, asl_get_IDPs log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_swMRI/struct_swMRI.py b/bip/pipelines/struct_swMRI/struct_swMRI.py index 6bb4c65..60af5bd 100755 --- a/bip/pipelines/struct_swMRI/struct_swMRI.py +++ b/bip/pipelines/struct_swMRI/struct_swMRI.py @@ -10,7 +10,7 @@ # import logging -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from bip.pipelines.struct_swMRI import swMRI_proc log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_swMRI/swMRI_gdc.py b/bip/pipelines/struct_swMRI/swMRI_gdc.py index d9c2880..00aee31 100755 --- a/bip/pipelines/struct_swMRI/swMRI_gdc.py +++ b/bip/pipelines/struct_swMRI/swMRI_gdc.py @@ -12,7 +12,7 @@ import logging from shutil import copyfile from pipe_tree import In, Out, Ref -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from gradunwarp.core.gradient_unwarp_apply import gradient_unwarp_apply log = logging.getLogger(__name__) diff --git a/bip/pipelines/struct_swMRI/swMRI_proc.py b/bip/pipelines/struct_swMRI/swMRI_proc.py index 86c5cd3..5469cb4 100755 --- a/bip/pipelines/struct_swMRI/swMRI_proc.py +++ b/bip/pipelines/struct_swMRI/swMRI_proc.py @@ -15,7 +15,7 @@ import logging from shutil import copyfile from fsl import wrappers from pipe_tree import In, Out, Ref -from bip.utils import redirect_logging +from bip.utils.log_utils import redirect_logging from bip.pipelines.struct_swMRI.swMRI_proc_fnc import combine_magnitude_coils from bip.pipelines.struct_swMRI.swMRI_proc_fnc import gen_filtered_phase from gradunwarp.core.gradient_unwarp_apply import gradient_unwarp_apply diff --git a/bip/pipelines/struct_swMRI/swMRI_proc_fnc.py b/bip/pipelines/struct_swMRI/swMRI_proc_fnc.py index 5a1163e..17afae1 100755 --- a/bip/pipelines/struct_swMRI/swMRI_proc_fnc.py +++ b/bip/pipelines/struct_swMRI/swMRI_proc_fnc.py @@ -14,7 +14,7 @@ import nibabel as nib from fsl import wrappers import numpy as np import numpy.fft as ft -from bip.commands.read_json_field import read_json_field +from bip.utils.read_json_field import read_json_field def combine_magnitude_coils(MAG_TE1, MAG_TE2, MAG_TE1_dir, MAG_TE2_dir, num_coils, SOS_TE1, SOS_TE2, SOS_ratio, R2star, diff --git a/bip/commands/__init__.py b/bip/utils/__init__.py similarity index 100% rename from bip/commands/__init__.py rename to bip/utils/__init__.py diff --git a/bip/commands/get_b0s.py b/bip/utils/get_b0s.py similarity index 100% rename from bip/commands/get_b0s.py rename to bip/utils/get_b0s.py diff --git a/bip/commands/get_dwell_time.py b/bip/utils/get_dwell_time.py similarity index 89% rename from bip/commands/get_dwell_time.py rename to bip/utils/get_dwell_time.py index 5085da0..339494a 100755 --- a/bip/commands/get_dwell_time.py +++ b/bip/utils/get_dwell_time.py @@ -1,8 +1,8 @@ import os import nibabel as nib -from bip.commands.read_json_field import read_json_field +from bip.utils.read_json_field import read_json_field -def get_dt(img, json): +def get_dwell_time(img, json): if os.path.exists(json): t = read_json_field(fileName=json, fieldName="EffectiveEchoSpacing", rounding=4, multFactor=1000) diff --git a/bip/utils.py b/bip/utils/log_utils.py similarity index 100% rename from bip/utils.py rename to bip/utils/log_utils.py diff --git a/bip/commands/read_json_field.py b/bip/utils/read_json_field.py similarity index 100% rename from bip/commands/read_json_field.py rename to bip/utils/read_json_field.py -- GitLab