Beispiel #1
0
def create_view():
    from traitsui.api import View, Item, Group, CSVListEditor
    from traitsui.menu import OKButton, CancelButton
    view = View(Group(Item(name='working_dir'),
                      Item(name='sink_dir'),
                      Item(name='crash_dir'),
                      label='Directories', show_border=True),
                Group(Item(name='run_using_plugin'),
                      Item(name='plugin', enabled_when="run_using_plugin"),
                      Item(name='plugin_args', enabled_when="run_using_plugin"),
                      Item(name='test_mode'),
                      label='Execution Options', show_border=True),
                Group(Item(name='subjects', editor=CSVListEditor()),
                      Item(name='base_dir'),
                      Item(name='fwhm', editor=CSVListEditor()),
                      Item(name='inputs_template'),
                      Item(name='meanfunc_template'),
                      Item(name='fsl_mat_template'),
                      Item(name='affine_transformation_template'),
                      Item(name='unwarped_brain_template'),
                      Item(name='warp_field_template'),
                      Item(name='check_func_datagrabber'),
                      label='Subjects', show_border=True),
                Group(Item(name='standard_norm_template'),
                      Item(name='standard_warp_field_template'),
                      Item(name='standard_affine_transformation_template'),
                      label='Normalization', show_border=True),
                Group(Item(name='use_advanced_options'),
                    Item(name='advanced_script',enabled_when='use_advanced_options'),
                    label='Advanced',show_border=True),
                buttons=[OKButton, CancelButton],
                resizable=True,
                width=1050)
    return view
Beispiel #2
0
def create_view():
    from traitsui.api import View, Item, Group, CSVListEditor
    from traitsui.menu import OKButton, CancelButton
    view = View(Group(Item(name='working_dir'),
                      Item(name='sink_dir'),
                      Item(name='crash_dir'),
                      Item(name='surf_dir'),
                      label='Directories', show_border=True),
                Group(Item(name='run_using_plugin',enabled_when='not save_script_only'),Item('save_script_only'),
                      Item(name='plugin', enabled_when="run_using_plugin"),
                      Item(name='plugin_args', enabled_when="run_using_plugin"),
                      Item(name='test_mode'), Item("timeout"),
                      label='Execution Options', show_border=True),
                Group(Item(name='subjects', editor=CSVListEditor()),
                      Item(name='base_dir'),
                      Item(name='fwhm', editor=CSVListEditor()),
                      Item(name='inputs_template'),
                      Item(name='meanfunc_template'),
                      Item(name='fsl_mat_template'),
                      Item(name='check_func_datagrabber'),
                      label='Subjects', show_border=True),
                Group(Item(name='norm_template'),
                      Item(name="do_segment"),
                      Item(name='do_anatomical_only'),
                      label='Normalization', show_border=True),
                Group(Item(name='use_advanced_options'),
                    Item(name='advanced_script',enabled_when='use_advanced_options'),
                    label='Advanced',show_border=True),
                buttons=[OKButton, CancelButton],
                resizable=True,
                width=1050)
    return view
def create_view():
    from traitsui.api import View, Item, Group, CSVListEditor
    from traitsui.menu import OKButton, CancelButton
    view = View(Group(Item(name='uuid', style='readonly'),
                      Item(name='desc', style='readonly'),
                      label='Description',
                      show_border=True),
                Group(Item(name='working_dir'),
                      Item(name='sink_dir'),
                      Item(name='crash_dir'),
                      Item(name='json_sink'),
                      label='Directories',
                      show_border=True),
                Group(Item(name='run_using_plugin'),
                      Item(name='plugin', enabled_when="run_using_plugin"),
                      Item(name='plugin_args',
                           enabled_when="run_using_plugin"),
                      Item(name='test_mode'),
                      label='Execution Options',
                      show_border=True),
                Group(Item(name='subjects', editor=CSVListEditor()),
                      Item(name='base_dir', ),
                      Item(name='func_template'),
                      Item(name='check_func_datagrabber'),
                      Item(name='run_datagrabber_without_submitting'),
                      label='Subjects',
                      show_border=True),
                Group(Item(name='TR'),
                      Item(name='SliceOrder', editor=CSVListEditor()),
                      label='Motion Correction',
                      show_border=True),
                buttons=[OKButton, CancelButton],
                resizable=True,
                width=1050)
    return view
def create_view():
    from traitsui.api import View, Item, Group, CSVListEditor
    from traitsui.menu import OKButton, CancelButton
    view = View(Group(Item(name='uuid', style='readonly'),
                      Item(name='desc', style='readonly'),
                      label='Description',
                      show_border=True),
                Group(Item(name='working_dir'),
                      Item(name='sink_dir'),
                      Item(name='crash_dir'),
                      Item(name='surf_dir'),
                      label='Directories',
                      show_border=True),
                Group(Item(name='run_using_plugin',
                           enabled_when='not save_script_only'),
                      Item('save_script_only'),
                      Item(name='plugin', enabled_when="run_using_plugin"),
                      Item(name='plugin_args',
                           enabled_when="run_using_plugin"),
                      Item(name='test_mode'),
                      label='Execution Options',
                      show_border=True),
                Group(Item(name='subjects', editor=CSVListEditor()),
                      Item(name='base_dir'),
                      Item(name='func_template'),
                      Item(name='check_func_datagrabber'),
                      Item(name='run_datagrabber_without_submitting'),
                      Item(name='timepoints_to_remove'),
                      label='Subjects',
                      show_border=True),
                Group(Item(name="motion_correct_node"),
                      Item(name='TR'),
                      Item(name='do_slicetiming'),
                      Item('order'),
                      Item(name='SliceOrder', editor=CSVListEditor()),
                      label='Motion Correction',
                      show_border=True),
                Group(Item('csf_prob'),
                      Item('grey_prob'),
                      Item('white_prob'),
                      label='normalize',
                      show_border=True),
                Group(Item(name='norm_thresh'),
                      Item(name='z_thresh'),
                      label='Artifact Detection',
                      show_border=True),
                Group(Item(name='fwhm'), label='Smoothing', show_border=True),
                buttons=[OKButton, CancelButton],
                resizable=True,
                width=1050)
    return view
Beispiel #5
0
def create_view():
    from traitsui.api import View, Item, Group, CSVListEditor
    from traitsui.menu import OKButton, CancelButton
    view = View(Group(Item(name='uuid', style='readonly'),
                      Item(name='desc', style='readonly'),
                      label='Description',
                      show_border=True),
                Group(Item(name='working_dir'),
                      Item(name='crash_dir'),
                      Item('sink_dir'),
                      Item('surf_dir'),
                      label='Directories',
                      show_border=True),
                Group(Item(name='run_using_plugin',
                           enabled_when='not save_script_only'),
                      Item('save_script_only'),
                      Item(name='plugin', enabled_when="run_using_plugin"),
                      Item(name='plugin_args',
                           enabled_when="run_using_plugin"),
                      label='Execution Options',
                      show_border=True),
                Group(Item(name='datagrabber'),
                      label='Subjects',
                      show_border=True),
                Group(Item(name="motion_correct_node"),
                      Item(name='TR', enabled_when='not use_metadata'),
                      Item('use_metadata'),
                      Item(name='do_slicetiming'),
                      Item(name='SliceOrder',
                           editor=CSVListEditor(),
                           enabled_when='do_slicetiming and not use_metadata'),
                      Item('order', enabled_when='do_slicetiming'),
                      Item(name='loops',
                           enabled_when="motion_correct_node=='nipy' ",
                           editor=CSVListEditor()),
                      Item(name='speedup',
                           enabled_when="motion_correct_node=='nipy' ",
                           editor=CSVListEditor()),
                      label='Motion Correction',
                      show_border=True),
                Group(Item(name='use_advanced_options'),
                      Item(name='advanced_script',
                           enabled_when='use_advanced_options'),
                      label='Advanced',
                      show_border=True),
                buttons=[OKButton, CancelButton],
                resizable=True,
                width=1050)
    return view
Beispiel #6
0
def create_view():
    from traitsui.api import View, Item, Group, CSVListEditor, TupleEditor
    from traitsui.menu import OKButton, CancelButton
    view = View(Group(Item(name='working_dir'),
                      Item(name='sink_dir'),
                      Item(name='crash_dir'),
                      Item(name='surf_dir'),
                      label='Directories',
                      show_border=True),
                Group(Item(name='run_using_plugin'),
                      Item(name='plugin', enabled_when="run_using_plugin"),
                      Item(name='plugin_args',
                           enabled_when="run_using_plugin"),
                      Item(name='test_mode'),
                      label='Execution Options',
                      show_border=True),
                Group(Item(name='subjects', editor=CSVListEditor()),
                      label='Subjects',
                      show_border=True),
                Group(Item(name='use_advanced_options'),
                      Item(name='advanced_script',
                           enabled_when='use_advanced_options'),
                      label='Advanced',
                      show_border=True),
                buttons=[OKButton, CancelButton],
                resizable=True,
                width=1050)
    return view
Beispiel #7
0
def create_view():
    from traitsui.api import View, Item, Group, CSVListEditor
    from traitsui.menu import OKButton, CancelButton
    view = View(Group(Item(name='working_dir'),
                      Item(name='sink_dir'),
                      Item(name='crash_dir'),
                      Item(name='surf_dir'),
                      label='Directories', show_border=True),
                Group(Item(name='run_using_plugin'),
                      Item(name='plugin', enabled_when="run_using_plugin"),
                      Item(name='plugin_args', enabled_when="run_using_plugin"),
                      Item(name='test_mode'),
                      label='Execution Options', show_border=True),
                Group(Item(name='datagrabber'),
                      label='Subjects', show_border=True),
                Group(Item(name='target_surf'),
                      Item(name='surface_fwhm', editor=CSVListEditor()),
                      Item(name='projection_stem'),
                      Item(name='combine_surfaces'),
                      Item(name='surface_atlas'),
                      label='Smoothing', show_border=True),
                Group(Item(name='out_type'),
                      Item(name='hdf5_package',
                           enabled_when="out_type is 'hdf5'"),
                      label='Output', show_border=True),
                Group(Item(name='use_advanced_options'),
                    Item(name='advanced_script',enabled_when='use_advanced_options'),
                    label='Advanced',show_border=True),
                buttons=[OKButton, CancelButton],
                resizable=True,
                width=1050)
    return view
Beispiel #8
0
def create_view():
    from traitsui.api import View, Item, Group, CSVListEditor, TupleEditor
    from traitsui.menu import OKButton, CancelButton
    view = View(Group(Item(name='uuid', style='readonly'),
        Item(name='desc', style='readonly'),
        label='Description', show_border=True),
        Group(Item(name='working_dir'),
            Item(name='sink_dir'),
            Item(name='crash_dir'),
            label='Directories', show_border=True),
        Group(Item(name='run_using_plugin',enabled_when='save_script_only'),Item('save_script_only'),
            Item(name='plugin', enabled_when="run_using_plugin"),
            Item(name='plugin_args', enabled_when="run_using_plugin"),
            Item(name='test_mode'), Item("timeout"),
            label='Execution Options', show_border=True),
        Group(Item(name='subjects', editor=CSVListEditor()),
            Item(name='base_dir'),
            Item(name='dicom_dir_template'),
            label='Subjects', show_border=True),
        Group(Item('info_only'),
            Item('use_heuristic',enabled_when="not info_only"), 
            Item('no_moco',enabled_when="not info_only and not use_heuristic"),
            Item('heuristic_file',enabled_when="use_heuristic"),
            Item('embed_meta',enabled_when='not info_only')),
        buttons = [OKButton, CancelButton],
        resizable=True,
        width=1050)
    return view
Beispiel #9
0
def create_view():
    from traitsui.api import View, Item, Group, CSVListEditor
    from traitsui.menu import OKButton, CancelButton
    view = View(Group(Item(name='uuid', style='readonly'),
        Item(name='desc', style='readonly'),
        label='Description', show_border=True),
        Group(Item(name='working_dir'),
            Item(name='sink_dir'),
            Item(name='crash_dir'),
            label='Directories', show_border=True),
        Group(Item(name='run_using_plugin'),
            Item(name='plugin', enabled_when="run_using_plugin"),
            Item(name='plugin_args', enabled_when="run_using_plugin"),
            Item(name='test_mode'),
            label='Execution Options', show_border=True),
        Group(Item(name='subjects', editor=CSVListEditor()),
            label='Subjects', show_border=True),
        Group(Item(name='preproc_config'),
            label='Track', show_border=True),
        Group(Item("use_advanced_options"),
            Item("advanced_script"),
            label="Advanced",show_border=True),
        buttons = [OKButton, CancelButton],
        resizable=True,
        width=1050)
    return view
Beispiel #10
0
def create_view():
    from traitsui.api import View, Item, Group, CSVListEditor
    from traitsui.menu import OKButton, CancelButton
    view = View(Group(Item(name='uuid', style='readonly'),
                      Item(name='desc', style='readonly'),
                      label='Description',
                      show_border=True),
                Group(Item(name='working_dir'),
                      Item(name='sink_dir'),
                      Item(name='crash_dir'),
                      Item(name='surf_dir'),
                      label='Directories',
                      show_border=True),
                Group(Item(name='run_using_plugin'),
                      Item(name='plugin', enabled_when="run_using_plugin"),
                      Item(name='plugin_args',
                           enabled_when="run_using_plugin"),
                      Item(name='test_mode'),
                      label='Execution Options',
                      show_border=True),
                Group(Item(name='subjects', editor=CSVListEditor()),
                      Item(name='base_dir'),
                      Item(name='dwi_template'),
                      Item(name='bval_template'),
                      Item(name='bvec_template'),
                      Item(name='check_func_datagrabber'),
                      Item(name='run_datagrabber_without_submitting'),
                      Item(name='timepoints_to_remove'),
                      label='Subjects',
                      show_border=True),
                Group(Item(name='use_fieldmap'),
                      Item(name='field_dir', enabled_when="use_fieldmap"),
                      Item(name='magnitude_template',
                           enabled_when="use_fieldmap"),
                      Item(name='phase_template', enabled_when="use_fieldmap"),
                      Item(name='check_field_datagrabber',
                           enabled_when="use_fieldmap"),
                      Item(name='echospacing', enabled_when="use_fieldmap"),
                      Item(name='TE_diff', enabled_when="use_fieldmap"),
                      Item(name='sigma', enabled_when="use_fieldmap"),
                      label='Fieldmap',
                      show_border=True),
                Group(Item('do_rotate_bvecs'),
                      label='Diffusion_Options',
                      show_border=True),
                Group(Item(name='use_advanced_options'),
                      Item(name='advanced_script',
                           enabled_when='use_advanced_options'),
                      label='Advanced',
                      show_border=True),
                buttons=[OKButton, CancelButton],
                resizable=True,
                width=1050)
    return view
class DataBase(HasTraits):
    name = traits.Str('name')
    values = traits.List([''],traits.Str)
    iterable= traits.Bool(False)
    if use_view:
        from traitsui.api import View, Item, Group, CSVListEditor, TupleEditor, EnumEditor
        from traitsui.menu import OKButton, CancelButton
        view = View(Group(Item(name='name'), Item(name='values', editor=CSVListEditor()), Item(name='iterable')),
                    buttons=[OKButton, CancelButton],
                    resizable=True,
                    width=1050)
Beispiel #12
0
class GeomGetterWindow(Handler):
    #has to do the handler thing
    #for now proof of concept and notimplementederror
    geometry = List(Int)
    holder = Instance(NameHolder)

    traits_view = View(
        #Item('grid_representation', editor=InstanceEditor(), style='custom'),
        Item('holder',
             editor=InstanceEditor(),
             style='custom',
             show_label=False),
        Item('geometry', editor=CSVListEditor(), label='list geometry'),
        title='Specify geometry',
        kind='livemodal',
        buttons=OKCancelButtons,
    )
Beispiel #13
0
def create_view():
    from traitsui.api import View, Item, Group, CSVListEditor
    from traitsui.menu import OKButton, CancelButton
    view = View(Group(Item(name='uuid', style='readonly'),
                      Item(name='desc', style='readonly'),
                      label='Description',
                      show_border=True),
                Group(Item(name='working_dir'),
                      Item(name='sink_dir'),
                      Item(name='crash_dir'),
                      Item(name='json_sink'),
                      label='Directories',
                      show_border=True),
                Group(Item(name='run_using_plugin',
                           enabled_when='not save_script_only'),
                      Item('save_script_only'),
                      Item(name='plugin', enabled_when="run_using_plugin"),
                      Item(name='plugin_args',
                           enabled_when="run_using_plugin"),
                      Item(name='test_mode'),
                      Item(name='debug'),
                      label='Execution Options',
                      show_border=True),
                Group(Item(name='subjects', editor=CSVListEditor()),
                      label='Subjects',
                      show_border=True),
                Group(Item(name='preproc_config'),
                      Item(name='use_custom_ROI_list_file'),
                      Item(name='custom_ROI_list_file',
                           enabled_when='use_custom_ROI_list_file'),
                      label='Preprocessing Info'),
                Group(Item(name='use_advanced_options'),
                      Item(name='advanced_script',
                           enabled_when='use_advanced_options'),
                      label='Advanced',
                      show_border=True),
                buttons=[OKButton, CancelButton],
                resizable=True,
                width=1050)
    return view
class CUBADataTypeModelView(ModelView):
    """Wraps the CUBADataType node in a ModelView for easier representation
    and access.
    """
    traits_view = View(
        VGroup(
            Item("model.name", resizable=True, enabled_when="False"),
            Item("model.definition", resizable=True, enabled_when="False"),
            Item("model.type", enabled_when="False"),
            Item("model.shape", editor=CSVListEditor(), enabled_when="False"),
            Item("model.length",
                 visible_when="model.type == 'string'",
                 enabled_when="False"),
            label="CUBA Data Type",
            show_border=True,
        ))

    @on_trait_change("model.type")
    def _type_updated(self, type_):
        if type_ == "string":
            self.model.length = 128
        else:
            self.model.length = None
class Demo(HasTraits):

    list1 = List(Int)

    list2 = List(Float)

    list3 = List(Str, maxlen=3)

    list4 = List(Enum('red', 'green', 'blue', 2, 3))

    list5 = List(Range(low=0.0, high=10.0))

    # 'low' and 'high' are used to demonstrate lists containing dynamic ranges.
    low = Float(0.0)
    high = Float(1.0)

    list6 = List(Range(low=-1.0, high='high'))

    list7 = List(Range(low='low', high='high'))

    pop1 = Button("Pop from first list")

    sort1 = Button("Sort first list")

    # This will be str(self.list1).
    list1str = Property(Str, depends_on='list1')

    traits_view = \
        View(
            HGroup(
                # This VGroup forms the column of CSVListEditor examples.
                VGroup(
                    Item('list1', label="List(Int)",
                        editor=CSVListEditor(ignore_trailing_sep=False),
                        tooltip='options: ignore_trailing_sep=False'),
                    Item('list1', label="List(Int)", style='readonly',
                        editor=CSVListEditor()),
                    Item('list2', label="List(Float)",
                        editor=CSVListEditor(enter_set=True, auto_set=False),
                        tooltip='options: enter_set=True, auto_set=False'),
                    Item('list3', label="List(Str, maxlen=3)",
                        editor=CSVListEditor()),
                    Item('list4',
                         label="List(Enum('red', 'green', 'blue', 2, 3))",
                        editor=CSVListEditor(sep=None),
                        tooltip='options: sep=None'),
                    Item('list5', label="List(Range(low=0.0, high=10.0))",
                        editor=CSVListEditor()),
                    Item('list6', label="List(Range(low=-1.0, high='high'))",
                        editor=CSVListEditor()),
                    Item('list7', label="List(Range(low='low', high='high'))",
                        editor=CSVListEditor()),
                    springy=True,
                ),
                # This VGroup forms the right column; it will display the
                # Python str representation of the lists.
                VGroup(
                    UItem('list1str', editor=TextEditor(),
                                        enabled_when='False', width=240),
                    UItem('list1str', editor=TextEditor(),
                                        enabled_when='False', width=240),
                    UItem('list2', editor=TextEditor(),
                                        enabled_when='False', width=240),
                    UItem('list3', editor=TextEditor(),
                                        enabled_when='False', width=240),
                    UItem('list4', editor=TextEditor(),
                                        enabled_when='False', width=240),
                    UItem('list5', editor=TextEditor(),
                                        enabled_when='False', width=240),
                    UItem('list6', editor=TextEditor(),
                                        enabled_when='False', width=240),
                    UItem('list7', editor=TextEditor(),
                                        enabled_when='False', width=240),
                ),
            ),
            '_',
            HGroup('low', 'high', spring, UItem('pop1'), UItem('sort1')),
            Heading("Notes"),
            Label("Hover over a list to see which editor options are set, "
                  "if any."),
            Label("The editor of the first list, List(Int), uses "
                  "ignore_trailing_sep=False, so a trailing comma is "
                  "an error."),
            Label("The second list is a read-only view of the first list."),
            Label("The editor of the List(Float) example has enter_set=True "
                  "and auto_set=False; press Enter to validate."),
            Label("The List(Str) example will accept at most 3 elements."),
            Label("The editor of the List(Enum(...)) example uses sep=None, "
                  "i.e. whitespace acts as a separator."),
            Label("The last two List(Range(...)) examples take one or both "
                  "of their limits from the Low and High fields below."),
            width=720,
            title="CSVListEditor Demonstration",
        )

    def _list1_default(self):
        return [1, 4, 0, 10]

    def _get_list1str(self):
        return str(self.list1)

    def _pop1_fired(self):
        if len(self.list1) > 0:
            x = self.list1.pop()
            print x

    def _sort1_fired(self):
        self.list1.sort()
Beispiel #16
0
    def dynamic_view(self):
        return View(
            Item('electrodes',
                editor=TableEditor( columns = 
                    [ObjectColumn(label='electrode',
                                  editor=TextEditor(),
                                  style='readonly',
                                  editable=False,
                                  name='strrepr'),

                     ObjectColumn(label='corner',
                                  editor=CheckListEditor(
                                    values=['','corner 1','corner 2',
                                        'corner 3']),
                                  style='simple',
                                  name='corner'),

                     ObjectColumn(label='geometry',
                                  editor=CSVListEditor(),
                                  #editor=TextEditor(),
                                  #style='readonly',
                                  #editable=False,
                                  name='geom_coords'),
                                  
                     ObjectColumn(label='channel name',
                                  editor=TextEditor(),
                                  name='name'),

                     ObjectColumn(label='ROIs',
                                  editor=ListStrEditor(),
                                  editable=False, 
                                  name='roi_list'),
                     ],
                    selected='cur_sel',
                    deletable=True,
                    #row_factory=electrode_factory,
                    row_factory=self.electrode_factory,
                    ),
                show_label=False, height=350, width=700),

            HGroup(
                VGroup( 
                    Label( 'Automatic labeling parameters' ),
                    Item( 'name_stem' ),
                    HGroup(
                        Item( 'naming_convention' ),
                        Item( 'grid_type' ),
                    ),
                ),
                #VGroup(
                #    Label( 'ROI identification parameters' ),
                #    Item('parcellation'),
                #    Item('error_radius'),
                #),
                #VGroup(
                #    Label('Image parameters' ),
                #    Item('img_dpi', label='dpi'),
                #    Item('img_size', label='size', editor=CSVListEditor()),
                #),
            ),

            resizable=True, kind='panel', title='modify electrodes',
            #buttons=[OKButton, swap_action, label_auto_action,
            #    interpolate_action, save_montage_action, find_rois_action]) 

            buttons = [self.label_auto_action, self.swap_action, OKButton],
            menubar = MenuBar(
                Menu( self.label_auto_action, self.add_blank_action,
                    self.interpolate_action, self.find_rois_action, 
                    self.find_all_rois_action,
                    self.manual_reposition_action,
                    name='Operations',
                ),
                Menu( self.save_montage_action, self.save_csv_action,
                    self.save_coronal_slice_action,
                    name='Save Output',
                ),
            )
        )
Beispiel #17
0
def create_view():
    from traitsui.api import View, Item, Group, CSVListEditor, TupleEditor
    from traitsui.menu import OKButton, CancelButton
    view = View(
        Group(Item(name='uuid', style='readonly'),
              Item(name='desc', style='readonly'),
              label='Description',
              show_border=True),
        Group(Item(name='working_dir'),
              Item(name='sink_dir'),
              Item(name='crash_dir'),
              Item(name='surf_dir'),
              label='Directories',
              show_border=True),
        Group(Item(name='run_using_plugin'),
              Item(name='plugin', enabled_when="run_using_plugin"),
              Item(name='plugin_args', enabled_when="run_using_plugin"),
              Item(name='test_mode'),
              Item('update_hash'),
              label='Execution Options',
              show_border=True),
        Group(Item(name='subjects', editor=CSVListEditor()),
              Item(name='base_dir', ),
              Item(name='func_template'),
              Item(name='check_func_datagrabber'),
              Item(name='run_datagrabber_without_submitting'),
              Item(name='timepoints_to_remove'),
              label='Subjects',
              show_border=True),
        Group(Item(name='use_fieldmap'),
              Item(name='field_dir', enabled_when="use_fieldmap"),
              Item(name='magnitude_template', enabled_when="use_fieldmap"),
              Item(name='phase_template', enabled_when="use_fieldmap"),
              Item(name='check_field_datagrabber',
                   enabled_when="use_fieldmap"),
              Item(name='echospacing', enabled_when="use_fieldmap"),
              Item(name='TE_diff', enabled_when="use_fieldmap"),
              Item(name='sigma', enabled_when="use_fieldmap"),
              label='Fieldmap',
              show_border=True),
        Group(Item(name="do_despike"),
              Item(name="motion_correct_node"),
              Item(name='TR', enabled_when="not use_metadata"),
              Item(name='do_slicetiming'),
              Item(name="use_metadata"),
              Item(name='SliceOrder',
                   editor=CSVListEditor(),
                   enabled_when="not use_metadata or not do_slicetiming"),
              Item(name='loops',
                   enabled_when="motion_correct_node=='nipy' ",
                   editor=CSVListEditor()),
              Item(name='speedup',
                   enabled_when="motion_correct_node=='nipy' ",
                   editor=CSVListEditor()),
              label='Motion Correction',
              show_border=True),
        Group(Item(name='norm_thresh'),
              Item(name='z_thresh'),
              label='Artifact Detection',
              show_border=True),
        Group(Item(name='compcor_select'),
              Item(name='num_noise_components'),
              Item(name='regress_before_PCA'),
              label='CompCor',
              show_border=True),
        Group(Item(name='reg_params'),
              label='Nuisance Filtering',
              show_border=True),
        Group(Item(name='smooth_type'),
              Item(name='fwhm', editor=CSVListEditor()),
              Item(name='surface_fwhm'),
              label='Smoothing',
              show_border=True),
        Group(Item(name='highpass_freq'),
              Item(name='lowpass_freq'),
              Item(name='filtering_algorithm'),
              Item(name='do_whitening'),
              label='Bandpass Filter',
              show_border=True),
        Group(Item(name='do_zscore'),
              Item(name='use_advanced_options'),
              Item(name='advanced_script',
                   enabled_when='use_advanced_options'),
              Item(name='debug'),
              label='Advanced',
              show_border=True),
        buttons=[OKButton, CancelButton],
        resizable=True,
        width=1050)
    return view
Beispiel #18
0
class InfoPanel(HasTraits):
    cursor = Property(Tuple)
    cursor_ras = Property(Tuple)
    cursor_tkr = Property(Tuple)
    cursor_intensity = Float

    mouse = Tuple((0.,0.,0.))
    mouse_ras = Tuple((0.,0.,0.))
    mouse_tkr = Tuple((0.,0.,0.))
    mouse_intensity = Float

    cursor_csvlist = List(Float)
    cursor_ras_csvlist = List(Float)
    cursor_tkr_csvlist = List(Float)

    pin_tolerance = Float(7.5)
    currently_showing_list = List(Instance(NullInstanceHolder))
    currently_showing = Instance(NullInstanceHolder)

    add_electrode_button = Button('Make new elec here')
    confirm_movepin_internal_button = Button('Move elec here')
    confirm_movepin_postproc_button = Button('Move postproc')
    track_cursor_button = Button('Track cursor')
    reset_image_button = Button('Center image')

    minimum_contrast = Float( -2000 )
    maximum_contrast = Float( 5000 )

    traits_view = View(
        VGroup(
            Item('currently_showing', 
                editor=InstanceEditor(name='currently_showing_list'),
                style='custom'),
            Spring(),
            HGroup(
            Item('minimum_contrast', editor=TextEditor(enter_set=True,
                auto_set=False, evaluate=float)),
            Item('maximum_contrast', editor=TextEditor(enter_set=True,
                auto_set=False, evaluate=float)),
            ),
            Spring(),
            HGroup(
            Item('add_electrode_button', show_label=False),
            Item('track_cursor_button', show_label=False),
            Item('reset_image_button', show_label=False),
            ),
            HGroup(
            Item('confirm_movepin_internal_button', show_label=False),
            Item('confirm_movepin_postproc_button', show_label=False),
            ),
            Item('pin_tolerance'),
            Spring(),
            Item(name='cursor_csvlist', style='text', label='cursor',
                editor=CSVListEditor(enter_set=True, auto_set=False)),
            Item(name='cursor_ras_csvlist', style='text', label='cursor RAS',
                editor=CSVListEditor(enter_set=True, auto_set=False)),
            Item(name='cursor_tkr_csvlist', style='text', label='cursor tkr',
                editor=CSVListEditor(enter_set=True, auto_set=False)),
            Item(name='cursor_intensity', style='readonly',
                label='cursor intensity'),
            Item(name='mouse', style='readonly', label='mouse'),
            Item(name='mouse_ras', style='readonly', label='mouse RAS'),
            Item(name='mouse_tkr', style='readonly', label='mouse tkr'),
            Item(name='mouse_intensity', style='readonly',
                label='mouse intensity'),
        ),
        height=400, width=400,
        title='ilumbumbargu',
    )

    def _get_cursor(self):
        return tuple(self.cursor_csvlist)
    def _set_cursor(self, newval):
        self.cursor_csvlist = list(newval)
    def _get_cursor_ras(self):
        return tuple(self.cursor_ras_csvlist)
    def _set_cursor_ras(self, newval):
        self.cursor_ras_csvlist = list(newval)
    def _get_cursor_tkr(self):
        return tuple(self.cursor_tkr_csvlist)
    def _set_cursor_tkr(self, newval):
        self.cursor_tkr_csvlist = list(newval)
Beispiel #19
0
class SphereTSGUI(HasTraits):
    """
    Calculate and show the sphere TS using the TraitsUI framework.
    """

    default_material = 'Tungsten carbide'
    m = sphere_ts.material_properties()
    params = m[default_material]
    params['material'] = default_material
    params['a'] = 0.0381 / 2.0
    params['rho'] = 1026.2
    params['c'] = 1490.0

    spot_freqs = [12, 18, 38, 50, 70, 120, 200, 333, 420]
    spot_freqs = list(zip(spot_freqs, list(map(str, spot_freqs))))

    extra_spot_freqs = List(Range(low=0., exclude_low=True),
                            desc='comma separated frequencies [kHz]',
                            label='Additional spot freqs [kHz]')

    sphere_material = Str(params['material'], label='Material')
    sphere_diameter = Range(low=0.,
                            value=params['a'] * 2 * 1000.0,
                            exclude_low=True,
                            label='Diameter [mm]')
    sphere_density = Range(low=0.,
                           value=params['rho1'],
                           exclude_low=True,
                           label='Density [kg/m^3]')
    sphere_c1 = Range(low=0.,
                      value=params['c1'],
                      exclude_low=True,
                      label='Longitudal sound speed [m/s]')
    sphere_c2 = Range(low=0.,
                      value=params['c2'],
                      exclude_low=True,
                      label='Transverse sound speed [m/s]')

    use_ctd = Bool(True)
    use_another_material = Bool(False, label='Another material')

    fluid_c = Range(low=0.,
                    value=params['c'],
                    exclude_low=True,
                    label='Sound speed in water [m/s]')
    fluid_density = Range(low=0.,
                          value=params['rho'],
                          exclude_low=True,
                          label='Density of water [kg/m^3]')

    fluid_temperature = Range(-2.0, 60, 10.0, label='Temperature [degC]')
    fluid_salinity = Range(0.0, 60.0, 35.0, label='Salinity [PSU]')
    fluid_depth = Range(0.0, 15000.0, 30.0, label='Depth [m]')

    freq_start = Range(low=0.0, value=12., label='Start frequency [kHz]')
    freq_end = Range(low=0.0, value=200., label='End frequency [kHz]')

    averaging_bandwidth = Range(low=0.1,
                                value=2.5,
                                label='Bandwidth for averaged TS [kHz]')

    CalculateButton = Action(name='Calculate', action='calculate')
    AboutButton = Action(name='About', action='show_about')
    EK60Button = Action(name='EK60 tables', action='show_ek60_ts')
    CloseButton = Action(name='Close', action='close')

    aboutDialog = AboutDialog()
    ek60Dialog = EK60Dialog()

    view = View(
        Group(
            Group(Item('sphere_diameter'),
                  Item('sphere_material',
                       style='custom',
                       enabled_when='not use_another_material',
                       editor=EnumEditor(values=list(m.keys()), cols=2)),
                  Item('use_another_material'),
                  Item('sphere_density', enabled_when='use_another_material'),
                  Item('sphere_c1', enabled_when='use_another_material'),
                  Item('sphere_c2', enabled_when='use_another_material'),
                  label='Sphere properties',
                  show_border=True),
            '10',  # some extra space
            Group(Item('use_ctd', label='Calculate from T, S, and D'),
                  Item('fluid_temperature',
                       enabled_when='use_ctd',
                       style='text'),
                  Item('fluid_salinity', enabled_when='use_ctd', style='text'),
                  Item('fluid_depth', enabled_when='use_ctd', style='text'),
                  Item('fluid_c',
                       enabled_when='not use_ctd',
                       format_str='%.1f'),
                  Item('fluid_density',
                       enabled_when='not use_ctd',
                       format_str='%.1f'),
                  label='Environmental properties',
                  show_border=True),
            '10',  # some extra space
            Group(Item('spot_freqs',
                       style='custom',
                       label='Spot frequencies [kHz]',
                       editor=CheckListEditor(values=spot_freqs, cols=3)),
                  Item('extra_spot_freqs', editor=CSVListEditor()),
                  Item('freq_start'),
                  Item('freq_end'),
                  Item('averaging_bandwidth'),
                  label='Frequencies',
                  show_border=True)),
        resizable=True,
        title='Sphere TS calculator',
        buttons=[EK60Button, AboutButton, CalculateButton, CloseButton],
        handler=UIHandler())