Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dest="outlier_fraction",
default=cfg.default_outlier_fraction, required=False,
help=help_text_outlier_fraction)
outliers.add_argument("-olt", "--outlier_feat_types", action="store",
dest="outlier_feat_types",
default=cfg.t1_mri_features_OLD, required=False,
help=help_text_outlier_feat_types)
outliers.add_argument("-old", "--disable_outlier_detection", action="store_true",
dest="disable_outlier_detection",
required=False, help=help_text_disable_outlier_detection)
layout = parser.add_argument_group('Layout options', ' ')
layout.add_argument("-w", "--views", action="store", dest="views",
default=cfg.default_views, required=False, nargs='+',
help=help_text_views)
layout.add_argument("-s", "--num_slices", action="store", dest="num_slices",
default=cfg.default_num_slices, required=False,
help=help_text_num_slices)
layout.add_argument("-r", "--num_rows", action="store", dest="num_rows",
default=cfg.default_num_rows, required=False,
help=help_text_num_rows)
wf_args = parser.add_argument_group('Workflow', 'Options related to workflow '
'e.g. to pre-compute resource-intensive features, '
'and pre-generate all the visualizations required')
wf_args.add_argument("-p", "--prepare_first", action="store_true",
dest="prepare_first",
help=help_text_prepare)
Color can be specified in many ways as documented in https://matplotlib.org/users/colors.html
Default: {}.
\n""".format(cfg.default_contour_face_color))
help_text_alphas = textwrap.dedent("""
Alpha values to control the transparency of MRI and aseg.
This must be a set of two values (between 0 and 1.0) separated by a space e.g. --alphas 0.7 0.5.
Default: {} {}. Play with these values to find something that works for you and the dataset.
\n""".format(cfg.default_alpha_mri, cfg.default_alpha_seg))
help_text_views = textwrap.dedent("""
Specifies the set of views to display - could be just 1 view, or 2 or all 3.
Example: --views 0 (typically sagittal) or --views 1 2 (axial and coronal)
Default: {} {} {} (show all the views in the selected segmentation)
\n""".format(cfg.default_views[0], cfg.default_views[1], cfg.default_views[2]))
help_text_num_slices = textwrap.dedent("""
Specifies the number of slices to display per each view.
This must be even to facilitate better division.
Default: {}.
\n""".format(cfg.default_num_slices))
help_text_num_rows = textwrap.dedent("""
Specifies the number of rows to display per each axis.
Default: {}.
\n""".format(cfg.default_num_rows))
help_text_no_surface_vis = textwrap.dedent("""
This flag disables batch-generation of 3d surface visualizations, which are shown along with cross-sectional overlays. This is not recommended, but could be used in situations where you do not have Freesurfer installed or want to focus solely on cross-sectional views.
Default: False (required visualizations are generated at the beginning, which can take 5-10 seconds for each subject).
default=None, required=False, help=help_text_id_list)
in_out.add_argument("-o", "--out_dir", action="store", dest="out_dir",
default=None, required=False, help=help_text_out_dir)
vis = parser.add_argument_group('Visualization',
'Customize behaviour of comparisons')
vis.add_argument("-dl", "--delay_in_animation", action="store",
dest="delay_in_animation",
default=cfg.delay_in_animation, required=False,
help=help_text_delay_in_animation)
layout = parser.add_argument_group('Layout options', ' ')
layout.add_argument("-w", "--views", action="store", dest="views",
default=cfg.default_views, required=False, nargs='+',
help=help_text_views)
layout.add_argument("-s", "--num_slices", action="store", dest="num_slices",
default=cfg.default_num_slices, required=False,
help=help_text_num_slices)
layout.add_argument("-r", "--num_rows", action="store", dest="num_rows",
default=cfg.default_num_rows, required=False,
help=help_text_num_rows)
wf_args = parser.add_argument_group('Workflow', 'Options related to workflow '
'e.g. to pre-compute '
'resource-intensive features, '
'and pre-generate all the '
'visualizations required')
wf_args.add_argument("-p", "--prepare_first", action="store_true",
images_for_id,
in_dir,
out_dir,
vis_type=cfg.default_vis_type,
label_set=cfg.default_label_set,
issue_list=cfg.default_rating_list,
mri_name=cfg.default_mri_name,
seg_name=cfg.default_seg_name,
alpha_set=cfg.default_alpha_set,
outlier_method=cfg.default_outlier_detection_method,
outlier_fraction=cfg.default_outlier_fraction,
outlier_feat_types=cfg.freesurfer_features_outlier_detection,
source_of_features=cfg.default_source_of_features_freesurfer,
disable_outlier_detection=False,
no_surface_vis=False,
views=cfg.default_views,
num_slices_per_view=cfg.default_num_slices,
num_rows_per_view=cfg.default_num_rows):
"""Constructor"""
super().__init__(id_list, in_dir, out_dir,
outlier_method, outlier_fraction,
outlier_feat_types, disable_outlier_detection)
self.issue_list = issue_list
# in_dir_type must be freesurfer; vis_type must be freesurfer
self.mri_name = mri_name
self.seg_name = seg_name
self.label_set = label_set
self.vis_type = vis_type
self.images_for_id = images_for_id
Default: a new folder called ``{}`` will be created inside the input dir.
\n""".format(cfg.default_out_dir_name))
help_text_apply_preproc = textwrap.dedent("""
Whether to apply basic preprocessing steps (detrend, slice timing correction etc), before building the carpet image.
If the images are already preprocessed elsewhere, use this flag ``--apply_preproc``
Default is NOT to apply any preprocessing (detrending etc) before showing images for review.
\n""")
help_text_views = textwrap.dedent("""
Specifies the set of views to display - could be just 1 view, or 2 or all 3.
Example: --views 0 (typically sagittal) or --views 1 2 (axial and coronal)
Default: {} {} {} (show all the views in the selected segmentation)
\n""".format(cfg.default_views[0], cfg.default_views[1], cfg.default_views[2]))
help_text_num_slices = textwrap.dedent("""
Specifies the number of slices to display per each view.
This must be even to facilitate better division.
Default: {}.
\n""".format(cfg.default_num_slices))
help_text_num_rows = textwrap.dedent("""
Specifies the number of rows to display per each axis.
Default: {}.
\n""".format(cfg.default_num_rows))
help_text_prepare = textwrap.dedent("""
This flag enables batch-generation of 3d surface visualizations, prior to starting any review and rating operations.
This makes the switch from one subject to the next, even more seamless (saving few seconds :) ).
help_text_out_dir = textwrap.dedent("""
Output folder to store the visualizations & ratings.
Default: a new folder called ``{}`` will be created inside the ``fs_dir``
\n""".format(cfg.default_out_dir_name))
help_text_delay_in_animation = textwrap.dedent("""
Specifies the delay in animation of the display of two images (like in a GIF).
Default: {} (units in seconds).
\n""".format(cfg.delay_in_animation))
help_text_views = textwrap.dedent("""
Specifies the set of views to display - could be just 1 view, or 2 or all 3.
Example: --views 0 (typically sagittal) or --views 1 2 (axial and coronal)
Default: {} {} {} (show all the views in the selected segmentation)
\n""".format(cfg.default_views[0], cfg.default_views[1], cfg.default_views[2]))
help_text_num_slices = textwrap.dedent("""
Specifies the number of slices to display per each view.
This must be even to facilitate better division.
Default: {}.
\n""".format(cfg.default_num_slices))
help_text_num_rows = textwrap.dedent("""
Specifies the number of rows to display per each axis.
Default: {}.
\n""".format(cfg.default_num_rows))
help_text_prepare = textwrap.dedent("""
This flag does the heavy preprocessing first, prior to starting any review and
rating operations.
Heavy processing can include computation of registration quality metrics and
Default: a new folder called ``{}`` will be created inside the ``fs_dir``
\n""".format(cfg.default_out_dir_name))
help_text_no_preproc = textwrap.dedent("""
Whether to apply basic preprocessing steps (detrend, slice timing correction etc), before building the carpet image.
If the images are already preprocessed elsewhere, use this flag ``--no_preproc``
Default is to apply minimal preprocessing (detrending etc) before showing images for review.
\n""")
help_text_views = textwrap.dedent("""
Specifies the set of views to display - could be just 1 view, or 2 or all 3.
Example: --views 0 (typically sagittal) or --views 1 2 (axial and coronal)
Default: {} {} {} (show all the views in the selected segmentation)
\n""".format(cfg.default_views[0], cfg.default_views[1], cfg.default_views[2]))
help_text_num_slices = textwrap.dedent("""
Specifies the number of slices to display per each view.
This must be even to facilitate better division.
Default: {}.
\n""".format(cfg.default_num_slices))
help_text_num_rows = textwrap.dedent("""
Specifies the number of rows to display per each axis.
Default: {}.
\n""".format(cfg.default_num_rows))
help_text_prepare = textwrap.dedent("""
This flag enables batch-generation of 3d surface visualizations, prior to starting any review and rating operations.
This makes the switch from one subject to the next, even more seamless (saving few seconds :) ).
dest="outlier_fraction",
default=cfg.default_outlier_fraction, required=False,
help=help_text_outlier_fraction)
outliers.add_argument("-olt", "--outlier_feat_types", action="store",
dest="outlier_feat_types",
default=cfg.freesurfer_features_outlier_detection,
required=False, help=help_text_outlier_feat_types)
outliers.add_argument("-old", "--disable_outlier_detection", action="store_true",
dest="disable_outlier_detection",
required=False, help=help_text_disable_outlier_detection)
layout = parser.add_argument_group('Layout options', ' ')
layout.add_argument("-w", "--views", action="store", dest="views",
default=cfg.default_views, required=False, nargs='+',
help=help_text_views)
layout.add_argument("-s", "--num_slices", action="store", dest="num_slices",
default=cfg.default_num_slices, required=False,
help=help_text_num_slices)
layout.add_argument("-r", "--num_rows", action="store", dest="num_rows",
default=cfg.default_num_rows, required=False,
help=help_text_num_rows)
wf_args = parser.add_argument_group('Workflow', 'Options related to workflow '
'e.g. to pre-compute resource-intensive features, '
'and pre-generate all the visualizations required')
wf_args.add_argument("-ns", "--no_surface_vis", action="store_true",
dest="no_surface_vis", help=help_text_no_surface_vis)
def __init__(self,
id_list,
in_dir,
image_names,
out_dir,
in_dir_type='generic',
prepare_first=True,
delay_in_animation=cfg.delay_in_animation,
views=cfg.default_views,
num_slices_per_view=cfg.default_num_slices,
num_rows_per_view=cfg.default_num_rows,
):
"""Constructor"""
self.disable_outlier_detection = True
super().__init__(id_list, in_dir, out_dir,
None, None, None, # might add outlier detection later
disable_outlier_detection=self.disable_outlier_detection)
self.current_cmap = 'gray'
self.vis_type = 'Animate'
self.delay_in_animation = delay_in_animation
self.continue_animation = True
self.image_names = image_names
dest="outlier_fraction",
default=cfg.default_outlier_fraction, required=False,
help=help_text_outlier_fraction)
outliers.add_argument("-olt", "--outlier_feat_types", action="store",
dest="outlier_feat_types",
default=cfg.t1_mri_features_OLD, required=False,
help=help_text_outlier_feat_types)
outliers.add_argument("-old", "--disable_outlier_detection", action="store_true",
dest="disable_outlier_detection",
required=False, help=help_text_disable_outlier_detection)
layout = parser.add_argument_group('Layout options', ' ')
layout.add_argument("-w", "--views", action="store", dest="views",
default=cfg.default_views, required=False, nargs='+',
help=help_text_views)
layout.add_argument("-s", "--num_slices", action="store", dest="num_slices",
default=cfg.default_num_slices, required=False,
help=help_text_num_slices)
layout.add_argument("-r", "--num_rows", action="store", dest="num_rows",
default=cfg.default_num_rows, required=False,
help=help_text_num_rows)
wf_args = parser.add_argument_group('Workflow', 'Options related to workflow '
'e.g. to pre-compute resource-intensive features, '
'and pre-generate all the visualizations required')
wf_args.add_argument("-p", "--prepare_first", action="store_true",
dest="prepare_first",
help=help_text_prepare)