Skip to content

Commit

Permalink
Merge pull request #850 from ThoumyreStanislas/add_verbose
Browse files Browse the repository at this point in the history
[WIP] Add_verbose_arg
  • Loading branch information
arnaudbore authored Dec 15, 2023
2 parents d2fbbed + 6e16860 commit 7c9c29e
Show file tree
Hide file tree
Showing 144 changed files with 361 additions and 114 deletions.
10 changes: 10 additions & 0 deletions scilpy/io/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from PIL import Image
from scipy.io import loadmat
import six
import importlib.metadata

from scilpy.io.streamlines import load_tractogram_with_reference
from scilpy.gradients.bvec_bval_tools import DEFAULT_B0_THRESHOLD
Expand Down Expand Up @@ -876,3 +877,12 @@ def get_default_screenshotting_data(args):
labelmap_img, \
mask_imgs, \
masks_colors


def add_scilpy_version(verbose = True):

version = importlib.metadata.version('scilpy')

logging.getLogger().setLevel(logging.INFO)
logging.info("Scilpy version: {}".format(version))

3 changes: 2 additions & 1 deletion scripts/scil_NODDI_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ def _build_arg_parser():
help='Compute kernels only, --save_kernels must be used.')

add_processes_arg(p)
add_overwrite_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p


Expand Down
2 changes: 1 addition & 1 deletion scripts/scil_NODDI_priors.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def _build_arg_parser():
help='Output path for the ventricule mask.\nIf not set, '
'the mask will not be saved.')

add_overwrite_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p

Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_aodf_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
compute_odd_power_map)
from scilpy.io.utils import (add_processes_arg,
add_sh_basis_args,
add_verbose_arg,
assert_inputs_exist,
assert_outputs_exist,
add_overwrite_arg)
Expand Down Expand Up @@ -106,6 +107,7 @@ def _build_arg_parser():

add_processes_arg(p)
add_sh_basis_args(p)
add_verbose_arg(p)
add_overwrite_arg(p)
return p

Expand Down
2 changes: 1 addition & 1 deletion scripts/scil_btensor_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def _build_arg_parser():

add_force_b0_arg(p)
add_processes_arg(p)
add_overwrite_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)

p.add_argument(
'--not_all', action='store_true',
Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_bundle_compute_centroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from scilpy.io.utils import (add_overwrite_arg,
assert_inputs_exist,
assert_outputs_exist,
add_verbose_arg,
add_reference_arg)
from scilpy.tractanalysis.features import get_streamlines_centroid

Expand All @@ -32,6 +33,7 @@ def _build_arg_parser():
'[%(default)s].')

add_reference_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)
return p

Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_bundle_compute_endpoints_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from scilpy.io.streamlines import load_tractogram_with_reference
from scilpy.io.utils import (add_json_args,
add_verbose_arg,
add_overwrite_arg,
add_reference_arg,
assert_inputs_exist,
Expand Down Expand Up @@ -53,6 +54,7 @@ def _build_arg_parser():

add_json_args(p)
add_reference_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p
Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_bundle_diameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from scilpy.io.utils import (add_overwrite_arg,
add_reference_arg,
add_json_args,
add_verbose_arg,
assert_inputs_exist,
assert_output_dirs_exist_and_empty,
parser_color_type,
Expand Down Expand Up @@ -84,6 +85,7 @@ def _build_arg_parser():

add_reference_arg(p)
add_json_args(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p
Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_bundle_filter_by_occurence.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from scilpy.io.streamlines import load_tractogram_with_reference
from scilpy.io.utils import (add_overwrite_arg,
add_reference_arg,
add_verbose_arg,
assert_inputs_exist,
assert_outputs_exist)
from scilpy.tractanalysis.streamlines_metrics import compute_tract_counts_map
Expand Down Expand Up @@ -55,6 +56,7 @@ def _build_arg_parser():
'as part of the \'gold standard\'. [0.5]')

add_reference_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p
Expand Down
4 changes: 3 additions & 1 deletion scripts/scil_bundle_generate_priors.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from scilpy.io.utils import (add_overwrite_arg,
add_reference_arg,
add_sh_basis_args,
add_verbose_arg,
assert_inputs_exist,
assert_outputs_exist)
from scilpy.reconst.utils import find_order_from_nb_coeff
Expand Down Expand Up @@ -60,8 +61,9 @@ def _build_arg_parser():
help='Output directory for all generated files,\n'
'default is current directory.')

add_overwrite_arg(p)
add_reference_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p

Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_bundle_label_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from scilpy.io.streamlines import load_tractogram_with_reference
from scilpy.io.utils import (add_overwrite_arg,
add_reference_arg,
add_verbose_arg,
assert_inputs_exist,
assert_output_dirs_exist_and_empty)
from scilpy.tractanalysis.streamlines_metrics import compute_tract_counts_map
Expand Down Expand Up @@ -71,6 +72,7 @@ def _build_arg_parser():
help='Use the new labelling method (multi-centroids).')

add_reference_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p
Expand Down
3 changes: 2 additions & 1 deletion scripts/scil_bundle_mean_fixel_afd.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from scilpy.io.streamlines import load_tractogram_with_reference
from scilpy.io.utils import (add_overwrite_arg, add_sh_basis_args,
add_reference_arg,
add_reference_arg, add_verbose_arg,
assert_inputs_exist, assert_outputs_exist)
from scilpy.tractanalysis.afd_along_streamlines \
import afd_map_along_streamlines
Expand Down Expand Up @@ -48,6 +48,7 @@ def _build_arg_parser():

add_reference_arg(p)
add_sh_basis_args(p)
add_verbose_arg(p)
add_overwrite_arg(p)
return p

Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_bundle_mean_fixel_afd_from_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from scilpy.io.utils import (add_overwrite_arg,
add_processes_arg,
add_sh_basis_args,
add_verbose_arg,
assert_inputs_exist,
assert_outputs_exist,
validate_nbr_processes)
Expand Down Expand Up @@ -86,6 +87,7 @@ def _build_arg_parser():

add_processes_arg(p)
add_sh_basis_args(p)
add_verbose_arg(p)
add_overwrite_arg(p)
return p

Expand Down
3 changes: 3 additions & 0 deletions scripts/scil_bundle_mean_fixel_lobe_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from scilpy.io.streamlines import load_tractogram_with_reference
from scilpy.io.utils import (add_overwrite_arg,
add_reference_arg,
add_verbose_arg,
assert_inputs_exist, assert_outputs_exist)
from scilpy.tractanalysis.lobe_metrics_along_streamlines \
import lobe_specific_metric_map_along_streamlines
Expand Down Expand Up @@ -58,7 +59,9 @@ def _build_arg_parser():
'alignment. [%(default)s]')

add_reference_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p


Expand Down
5 changes: 3 additions & 2 deletions scripts/scil_bundle_mean_std.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from scilpy.utils.filenames import split_name_with_nii
from scilpy.io.streamlines import load_tractogram_with_reference
from scilpy.io.utils import (add_json_args,
add_reference_arg,
add_reference_arg, add_verbose_arg,
assert_inputs_exist, assert_outputs_exist,
verify_compatibility_with_reference_sft)
from scilpy.utils.metrics_tools import get_bundle_metrics_mean_std, \
Expand Down Expand Up @@ -68,9 +68,10 @@ def _build_arg_parser():
p.add_argument('--out_json',
help='Path of the output file. If not given, the output '
'is simply printed on screen.')

add_reference_arg(p)
add_json_args(p)

add_verbose_arg(p)
return p


Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_bundle_pairwise_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
add_overwrite_arg,
add_processes_arg,
add_reference_arg,
add_verbose_arg,
assert_inputs_exist,
assert_outputs_exist,
link_bundles_and_reference,
Expand Down Expand Up @@ -82,6 +83,7 @@ def _build_arg_parser():
add_processes_arg(p)
add_reference_arg(p)
add_json_args(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p
Expand Down
4 changes: 2 additions & 2 deletions scripts/scil_bundle_score_many_bundles_one_tractogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ def _build_arg_parser():
"file are considered \nas absolute paths.")

add_json_args(p)
add_overwrite_arg(p)
add_reference_arg(p)
add_verbose_arg(p)
add_bbox_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def _build_arg_parser():

add_processes_arg(p)
add_reference_arg(p)
add_verbose_arg(p)
add_json_args(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p
Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_bundle_shape_measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import numpy as np

from scilpy.io.utils import (add_json_args,
add_verbose_arg,
add_overwrite_arg,
add_processes_arg,
add_reference_arg,
Expand Down Expand Up @@ -85,6 +86,7 @@ def _build_arg_parser():
add_reference_arg(p)
add_processes_arg(p)
add_json_args(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p
Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_bundle_volume_per_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from scilpy.image.labels import get_data_as_labels
from scilpy.io.utils import (add_json_args,
add_verbose_arg,
add_overwrite_arg,
assert_inputs_exist)

Expand All @@ -36,6 +37,7 @@ def _build_arg_parser():
help='Bundle name.')

add_json_args(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p
Expand Down
4 changes: 2 additions & 2 deletions scripts/scil_clean_qbx_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ def _build_arg_parser():
help='Linewidth of the current cluster [%(default)s].')

add_reference_arg(p)
add_overwrite_arg(p)
add_verbose_arg(p)
add_bbox_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p

Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_connectivity_hdf5_average_density_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

from scilpy.io.streamlines import reconstruct_streamlines_from_hdf5
from scilpy.io.utils import (add_overwrite_arg,
add_verbose_arg,
add_processes_arg,
assert_inputs_exist,
assert_output_dirs_exist_and_empty,
Expand All @@ -48,6 +49,7 @@ def _build_arg_parser():
help='Binarize density maps before the population average.')

add_processes_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)
return p

Expand Down
2 changes: 1 addition & 1 deletion scripts/scil_connectivity_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def _build_arg_parser():
help='Does not affect the background of the original '
'matrices.')

add_overwrite_arg(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p

Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_connectivity_normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
normalize_matrix_from_values, normalize_matrix_from_parcel
from scilpy.image.volume_math import normalize_max, normalize_sum, base_10_log
from scilpy.io.utils import (add_overwrite_arg,
add_verbose_arg,
assert_inputs_exist,
assert_outputs_exist,
load_matrix_in_any_format,
Expand Down Expand Up @@ -95,6 +96,7 @@ def _build_arg_parser():
scale.add_argument('--log_10', action='store_true',
help='Apply a base 10 logarithm to the matrix.')

add_verbose_arg(p)
add_overwrite_arg(p)

return p
Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_connectivity_pairwise_agreement.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import numpy as np

from scilpy.io.utils import (add_json_args,
add_verbose_arg,
add_overwrite_arg,
assert_inputs_exist,
assert_outputs_exist,
Expand All @@ -38,6 +39,7 @@ def _build_arg_parser():
'one.')

add_json_args(p)
add_verbose_arg(p)
add_overwrite_arg(p)

return p
Expand Down
2 changes: 2 additions & 0 deletions scripts/scil_connectivity_print_filenames.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import numpy as np

from scilpy.io.utils import (add_overwrite_arg,
add_verbose_arg,
assert_inputs_exist,
assert_outputs_exist,
load_matrix_in_any_format)
Expand All @@ -39,6 +40,7 @@ def _build_arg_parser():
p.add_argument('out_txt',
help='Output text file containing all filenames.')

add_verbose_arg(p)
add_overwrite_arg(p)

return p
Expand Down
Loading

0 comments on commit 7c9c29e

Please sign in to comment.