Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
help_text_image2 = textwrap.dedent("""
Specifies the name of second 3d image to serve as the comparison image
Order of the two images does not typically matter.
\n""")
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: {}.
in_out.add_argument("-n", "--image_names", action="store",
dest="image_names", nargs='+',
required=True, help=help_text_image_names)
in_out.add_argument("-l", "--id_list", action="store", dest="id_list",
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 '
in_out.add_argument("-n", "--name_pattern", action="store", dest="name_pattern",
default=cfg.default_name_pattern, required=False,
help=help_text_name_pattern)
preproc = parser.add_argument_group('Preprocessing',
'options related to preprocessing before review')
preproc.add_argument("-ap", "--apply_preproc", action="store_true",
dest="apply_preproc",
required=False, help=help_text_apply_preproc)
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)
outliers = parser.add_argument_group('Outlier detection',
'options related to automatically detecting possible outliers')
outliers.add_argument("-olm", "--outlier_method", action="store",
dest="outlier_method",
default=cfg.default_outlier_detection_method, required=False,
help=help_text_outlier_detection_method)
outliers.add_argument("-olf", "--outlier_fraction", action="store",
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",
in_out.add_argument("-i2", "--image2", action="store", dest="image2",
required=True, help=help_text_image2)
in_out.add_argument("-l", "--id_list", action="store", dest="id_list",
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)
outliers = parser.add_argument_group('Outlier detection',
'options related to automatically detecting possible outliers')
outliers.add_argument("-olm", "--outlier_method", action="store",
dest="outlier_method",
default=cfg.default_outlier_detection_method, required=False,
help=help_text_outlier_detection_method)
outliers.add_argument("-olf", "--outlier_fraction", action="store",
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",
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
\n""")
help_text_image_names = textwrap.dedent("""
Specifies the names of 3d images to be QCed.
\n""")
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: {}.
def __init__(self,
id_list,
in_dir,
image1_name,
image2_name,
out_dir,
issue_list=cfg.default_rating_list,
in_dir_type='generic',
prepare_first=True,
vis_type=cfg.alignment_default_vis_type,
delay_in_animation=cfg.delay_in_animation,
outlier_method=cfg.default_outlier_detection_method,
outlier_fraction=cfg.default_outlier_fraction,
outlier_feat_types=cfg.freesurfer_features_outlier_detection,
disable_outlier_detection=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.vis_type = vis_type
self.current_cmap = cfg.alignment_cmap[self.vis_type]