Esempio n. 1
0
    def update(self):
        enable = self.calib()
        self.seq_tr_num.Enable(enable)
        self.calib_image_picker.Enable(enable)
        self.calib_gain_num.Enable(enable)
        self.coil_image_picker.checkbox.Enable(enable)
        if self.analysis.white_paper():
            self.calib_mode_ch.SetSelection(1)
        self.calib_mode_ch.Enable(enable and not self.analysis.white_paper())
        self.ref_tissue_type_ch.Enable(enable and self.refregion())

        if self.ref_tissue_type() == 3:
            # Ref tissue = None - enforce mask
            self.ref_tissue_mask_picker.checkbox.Enable(False)
            self.ref_tissue_mask_picker.checkbox.SetValue(enable and self.refregion())
            self.ref_tissue_mask_picker.Enable(enable and self.refregion())
        else:
            self.ref_tissue_mask_picker.checkbox.Enable(enable and self.refregion())
        self.ref_tissue_mask_picker.Enable(enable and self.refregion() and self.ref_tissue_mask_picker.checkbox.IsChecked())

        self.coil_image_picker.checkbox.Enable(enable and self.refregion())
        self.coil_image_picker.Enable(enable and self.refregion() and self.coil_image_picker.checkbox.IsChecked())
        self.seq_te_num.Enable(enable and self.refregion())
        self.blood_t2_num.Enable(enable and self.refregion())
        self.ref_t1_num.Enable(enable and self.refregion())
        self.ref_t2_num.Enable(enable and self.refregion())
        TabPage.update(self)
Esempio n. 2
0
    def update(self):
        mode = self.struc_ch.GetSelection()
        self.fsl_anat_picker.Enable(mode == self.EXISTING_FSLANAT)
        self.struc_image_picker.Enable(mode in (self.NEW_FSLANAT,
                                                self.INDEP_STRUC))

        self.brain_image_picker.checkbox.Enable(mode == self.INDEP_STRUC)
        self.brain_image_picker.Enable(
            mode == self.INDEP_STRUC
            and self.brain_image_picker.checkbox.IsChecked())

        TabPage.update(self)
Esempio n. 3
0
    def update(self):
        self.distcorr_ch.Enable(self.distcorr())

        cal = self.distcorr() and not self.distcorr_fmap()
        self.calib_picker.Enable(cal)

        fmap = self.distcorr() and self.distcorr_fmap()
        self.fmap_picker.Enable(fmap)
        self.fmap_mag_picker.Enable(fmap)
        self.fmap_be_picker.Enable(fmap)

        self.pedir_ch.Enable(self.distcorr())
        self.echosp_num.Enable(self.distcorr())

        TabPage.update(self)
Esempio n. 4
0
    def __init__(self, parent, idx, n):
        TabPage.__init__(self,
                         parent,
                         "Distortion Correction",
                         idx,
                         n,
                         name="distcorr")

        self.distcorr_choices = ["Fieldmap", "Calibration image"]

        self.section("Distortion Correction")

        # Calibration image options
        self.distcorr_cb = wx.CheckBox(self,
                                       label="Apply distortion correction")
        self.distcorr_cb.Bind(wx.EVT_CHECKBOX, self._changed)

        self.distcorr_ch = wx.Choice(self, choices=self.distcorr_choices[:1])
        self.distcorr_ch.SetSelection(self.FIELDMAP)
        self.distcorr_ch.Bind(wx.EVT_CHOICE, self._changed)
        self.pack("", self.distcorr_cb, self.distcorr_ch, enable=False)

        # Calib image options
        self.section("Calibration Image Mode")
        self.calib_picker = self.file_picker(
            "Phase-encode-reversed calibration image")

        # Fieldmap options
        self.section("Fieldmap Mode")
        self.fmap_picker = self.file_picker("Fieldmap image (in rad/s)")
        self.fmap_mag_picker = self.file_picker("Fieldmap magnitude image")
        self.fmap_be_picker = self.file_picker(
            "Brain-extracted magnitude image", optional=True)

        # General options
        self.section("General")
        self.echosp_num = self.number("Effective EPI echo spacing",
                                      minval=0,
                                      maxval=10)
        self.pedir_ch = self.choice("Phase encoding direction",
                                    choices=["x", "y", "z", "-x", "-y", "-z"])

        self.sizer.AddGrowableCol(1, 1)
        #sizer.AddGrowableRow(5, 1)
        self.SetSizer(self.sizer)
        self.next_prev()
Esempio n. 5
0
    def update(self):
        self.ti_list.set_size(self.ntis())
        self.bolus_dur_list.set_size(self.ntis())

        self.time_per_slice_num.Enable(self.readout_2d())
        self.multiband_cb.Enable(self.readout_2d())
        self.slices_per_band_spin.Enable(self.multiband()
                                         and self.readout_2d())
        self.slices_per_band_label.Enable(self.multiband()
                                          and self.readout_2d())

        self.bolus_dur_num.Enable(not self.bolus_dur_multi())
        self.bolus_dur_list.Enable(self.bolus_dur_multi())

        self.tc_ch.Enable(self.tc_pairs())
        self.update_groups()

        TabPage.update(self)
Esempio n. 6
0
    def __init__(self, parent, idx, n):
        TabPage.__init__(self, parent, "Analysis", idx, n)

        self.distcorr_choices = ["Fieldmap", "Calibration image"]

        self.section("Basic analysis options")

        self.outdir_picker = self.file_picker("Output Directory",
                                              pick_dir=True)
        self.mask_picker = self.file_picker("Brain Mask", optional=True)
        self.wp_cb = self.checkbox(
            "Analysis which conforms to 'White Paper' (Alsop et al 2014)",
            handler=self.wp_changed)

        self.section("Initial parameter values")

        self.bat_num = self.number("Arterial Transit Time (s)",
                                   minval=0,
                                   maxval=2.5,
                                   initial=1.3)
        self.t1_num = self.number("T1 (s)", minval=0, maxval=3, initial=1.3)
        self.t1b_num = self.number("T1b (s)", minval=0, maxval=3, initial=1.65)
        self.ie_num = self.number("Inversion Efficiency",
                                  minval=0,
                                  maxval=1,
                                  initial=0.85)

        self.section("Analysis Options")

        self.spatial_cb = self.checkbox(
            "Adaptive spatial regularization on perfusion", initial=True)
        self.infer_t1_cb = self.checkbox("Incorporate T1 value uncertainty")
        self.macro_cb = self.checkbox("Include macro vascular component")
        self.fixbolus_cb = self.checkbox("Fix label duration", initial=True)

        self.pv_cb = self.checkbox("Partial Volume Correction")
        self.mc_cb = self.checkbox("Motion Correction")

        self.sizer.AddGrowableCol(1, 1)
        #sizer.AddGrowableRow(5, 1)
        self.SetSizer(self.sizer)
        self.next_prev()
Esempio n. 7
0
    def __init__(self, parent, idx, n):
        TabPage.__init__(self, parent, "Structure", idx, n, name="structure")

        self.section("Structure")

        self.struc_ch = wx.Choice(self,
                                  choices=[
                                      "Existing FSL_ANAT output",
                                      "Run FSL_ANAT on structural image",
                                      "Independent structural data", "None"
                                  ])
        self.struc_ch.SetSelection(self.NONE)
        self.struc_ch.Bind(wx.EVT_CHOICE, self._changed)
        self.struc_ch.span = 2
        self.pack("Structural data from", self.struc_ch)

        self.fsl_anat_picker = self.file_picker("Existing FSL_ANAT directory",
                                                pick_dir=True)
        self.struc_image_picker = self.file_picker("Structural Image")
        self.brain_image_picker = self.file_picker("Brain image",
                                                   optional=True)

        self.section("Registration")

        self.transform_choices = [
            "Use matrix", "Use warp image", "Use FSL_ANAT"
        ]

        self.transform_cb = wx.CheckBox(self,
                                        label="Transform to standard space")
        self.transform_cb.Bind(wx.EVT_CHECKBOX, self._changed)
        self.pack("", self.transform_cb, enable=False)

        self.sizer.AddGrowableCol(2, 1)
        self.SetSizer(self.sizer)
        self.next_prev()
Esempio n. 8
0
    def __init__(self, parent, idx, n):
        TabPage.__init__(self, parent, "Calibration", idx, n)

        self.calib_cb = self.checkbox("Enable Calibration", bold=True, handler=self.calib_changed)

        self.calib_image_picker = self.file_picker("Calibration Image")
        self.seq_tr_num = self.number("Sequence TR (s)", minval=0, maxval=10, initial=6)
        self.calib_gain_num = self.number("Calibration Gain", minval=0, maxval=5, initial=1)
        self.calib_mode_ch = self.choice("Calibration mode", choices=["Reference Region", "Voxelwise"])

        self.section("Reference tissue")

        self.ref_tissue_type_ch = self.choice("Type", choices=["CSF", "WM", "GM", "None"],
                                              handler=self.ref_tissue_type_changed)
        self.ref_tissue_mask_picker = self.file_picker("Mask", optional=True)
        self.ref_t1_num = self.number("Reference T1 (s)", minval=0, maxval=5, initial=4.3)
        self.seq_te_num = self.number("Sequence TE (ms)", minval=0, maxval=30, initial=0)
        self.ref_t2_num = self.number("Reference T2 (ms)", minval=0, maxval=1000, initial=750, step=10)
        self.blood_t2_num = self.number("Blood T2 (ms)", minval=0, maxval=1000, initial=150, step=10)
        self.coil_image_picker = self.file_picker("Coil Sensitivity Image", optional=True)

        self.sizer.AddGrowableCol(2, 1)
        self.SetSizer(self.sizer)
        self.next_prev()
Esempio n. 9
0
 def update(self):
     self.mask_picker.Enable(self.mask_picker.checkbox.IsChecked())
     self.t1_num.Enable(not self.white_paper())
     self.bat_num.Enable(not self.white_paper())
     TabPage.update(self)
Esempio n. 10
0
    def __init__(self, parent, idx, n):
        TabPage.__init__(self, parent, "Input Data", idx, n, name="input")

        self.groups = ["PLDs", "Repeats", "Label/Control pairs"]
        self.abbrevs = ["t", "r", "l"]

        self.section("Data contents")

        self.data_picker = self.file_picker("Input Image",
                                            handler=self.set_default_dir)
        self.ntis_int = self.integer("Number of PLDs",
                                     minval=1,
                                     maxval=100,
                                     initial=1)
        self.nrepeats_label = wx.StaticText(self, label="<Unknown>")
        self.pack("Number of repeats", self.nrepeats_label)

        self.section("Data order")

        self.choice1 = wx.Choice(self, choices=self.groups)
        self.choice1.SetSelection(2)
        self.choice1.Bind(wx.EVT_CHOICE, self._changed)
        self.choice2 = wx.Choice(self, choices=self.groups)
        self.choice2.SetSelection(0)
        self.choice2.Bind(wx.EVT_CHOICE, self._changed)
        self.pack("Grouping order", self.choice1, self.choice2)
        self.tc_ch = self.choice(
            "Label/Control pairs",
            choices=["Label then control", "Control then label"],
            optional=True,
            initial_on=True)

        self.section("Acquisition parameters")

        self.labelling_ch = self.choice("Labelling",
                                        choices=["pASL", "cASL/pcASL"],
                                        initial=1,
                                        handler=self.labelling_changed)

        self.bolus_dur_ch = wx.Choice(self, choices=["Constant", "Variable"])
        self.bolus_dur_ch.SetSelection(0)
        self.bolus_dur_ch.Bind(wx.EVT_CHOICE, self._changed)
        self.bolus_dur_num = NumberChooser(self,
                                           minval=0,
                                           maxval=2.5,
                                           step=0.1,
                                           initial=1.8)
        self.bolus_dur_num.span = 2
        self.bolus_dur_num.spin.Bind(wx.EVT_SPINCTRL, self.bolus_dur_changed)
        self.bolus_dur_num.slider.Bind(wx.EVT_SLIDER, self.bolus_dur_changed)
        self.pack("Bolus duration (s)", self.bolus_dur_ch, self.bolus_dur_num)

        self.bolus_dur_list = NumberList(self, self.ntis())
        self.bolus_dur_list.span = 3
        self.bolus_dur_list.Bind(wx.grid.EVT_GRID_CELL_CHANGED, self._changed)
        self.pack("Bolus durations (s)", self.bolus_dur_list, enable=False)

        self.ti_list = NumberList(self, self.ntis())
        self.ti_list.span = 3
        self.ti_list.Bind(wx.grid.EVT_GRID_CELL_CHANGED, self._changed)
        self.pack("PLDs (s)", self.ti_list)

        self.readout_ch = wx.Choice(
            self, choices=["3D (eg GRASE)", "2D multi-slice (eg EPI)"])
        self.readout_ch.SetSelection(0)
        self.readout_ch.Bind(wx.EVT_CHOICE, self._changed)
        self.time_per_slice_num = NumberChooser(self,
                                                label="Time per slice (ms)",
                                                minval=0,
                                                maxval=50,
                                                step=1,
                                                initial=10)
        self.time_per_slice_num.span = 2
        self.pack("Readout", self.readout_ch, self.time_per_slice_num)
        self.time_per_slice_num.Enable(False)

        self.multiband_cb = wx.CheckBox(self, label="Multi-band")
        self.multiband_cb.Bind(wx.EVT_CHECKBOX, self._changed)
        self.slices_per_band_spin = wx.SpinCtrl(self,
                                                min=1,
                                                max=100,
                                                initial=5)
        self.slices_per_band_label = wx.StaticText(self,
                                                   label="slices per band")
        self.pack("",
                  self.multiband_cb,
                  self.slices_per_band_spin,
                  self.slices_per_band_label,
                  enable=False)
        self.multiband_cb.Enable(False)

        self.sizer.AddGrowableCol(2, 1)
        self.SetSizer(self.sizer)
        self.next_prev()