Пример #1
0
    def __init__(self, rw):
        self.rw = rw
        self.rw_warp = ris_widget.RisWidget()
        self.layout = Qt.QFormLayout()
        spline_widget = Qt.QWidget()
        spline_widget.setLayout(self.layout)

        self.warp = Qt.QPushButton("Warp Worm")
        self.clear = Qt.QPushButton("Clear")
        self.layout.addRow(self.warp)
        self.rw.flipbook.layout().addWidget(spline_widget)

        self.warp.clicked.connect(self._on_warp_clicked)
Пример #2
0
def main(argv=None):
    import argparse

    parser = argparse.ArgumentParser(description='straighten worm images')
    parser.add_argument('pixels_per_micron', nargs='?', default=1/1.3, type=float, metavar='pixels_per_micron', help='conversion factor for objective used')
    parser.add_argument('images', nargs="*", metavar='image', help='image files to open')

    args = parser.parse_args(argv)
    rw = ris_widget.RisWidget()
    gp = GeneralPoseAnnotator(rw, pixels_per_micron=args.pixels_per_micron)

    rw.add_image_files_to_flipbook(args.images)
    rw.run()
Пример #3
0
    def __init__(self,
                 in_dir,
                 image_glob,
                 labels,
                 autosave_dir=None,
                 start_idx=0,
                 stop_idx=None):
        self.rw = ris_widget.RisWidget()
        self._init_notefield()

        if type(autosave_dir) is str:
            self.autosave_dir = pathlib.Path(autosave_dir)
        else:
            self.autosave_dir = autosave_dir

        self.in_dir = in_dir
        self.labels = labels
        self.image_glob = image_glob
        self.start_idx = start_idx
        self.stop_idx = stop_idx
        self.all_images, self.worm_positions = self.parse_inputs()
        #self.dictionary=dict.fromkeys(self.worm_positions)
        #for key, entry in self.dictionary.items():
        #self.dictionary[key]=dict.fromkeys(labels)
        self.worm_info = pd.DataFrame(index=self.worm_positions,
                                      columns=self.labels +
                                      ['Notes'])  # Add extra field for notes

        self.set_index(0)
        self.actions = []
        #self._add_action('left', Qt.Qt.Key_Left, lambda: self.load_next_worm(self.well_index,-1))
        #self._add_action('right', Qt.Qt.Key_Right, lambda: self.load_next_worm(self.well_index,1))
        self._add_action(
            'prev', Qt.Qt.Key_BracketLeft,
            lambda: self.load_next_worm(self.well_index, -1)
        )  # Changed these because I tended to accidentally hit side keys
        self._add_action('next', Qt.Qt.Key_BracketRight,
                         lambda: self.load_next_worm(self.well_index, 1))
        self._add_action('Save Annotations', QtGui.QKeySequence('Ctrl+S'),
                         self.save_annotations)
        self.rw.qt_object.main_view_toolbar.addAction(self.actions[-1])
        self._add_action('Load Annotations', QtGui.QKeySequence('Ctrl+O'),
                         self.load_annotations)
        self.rw.qt_object.main_view_toolbar.addAction(self.actions[-1])
        self._add_action('Goto Index', QtGui.QKeySequence('Ctrl+G'),
                         self.goto_index)
        self.rw.qt_object.main_view_toolbar.addAction(self.actions[-1])
        self.rw.show()
Пример #4
0
    experiment_dir = pathlib.Path(
        '/mnt/9karray/Sinha_Drew/20180518_spe-9_Run_3/')
    timepoint = '2018-05-22t1716'  # Early timepoint
    timepoint = '2018-05-28t1710'  # Late timepoint ~8d - eggs are super autofluorescent!!!!! churned up food doesn't help either....

    experiment_dir = pathlib.Path(
        '/mnt/9karray/Sinha_Drew/20180524_spe-9_Run_4/')
    timepoint = '2018-05-28t1526'  # Early timepoint
    timepoint = '2018-06-03t1714'  # Late timepoint ~8d ..

    if view_files:
        try:
            rw
        except NameError:
            rw = ris_widget.RisWidget()
            rw.show()

    def timepoint_filter(position_name, timepoint_name):
        return timepoint_name == timepoint

    experiment_images = load_data.scan_experiment_dir(
        experiment_dir,
        timepoint_filter=timepoint_filter,
        channels=['bf', 'green_yellow_excitation_autofluorescence'])

    image_names, images = [], []
    fl_image_modes = []  # Measurement of the gel
    fl_image_center_medians = [
    ]  # Measurement of the food (1100,900) to (1300, 1100)
    for position_name, position_images in experiment_images.items():
Пример #5
0
def make_global_riswidget():
    rw_defined = 'rw' in globals()
    global rw
    if not rw_defined:
        rw = ris_widget.RisWidget()
    return rw
Пример #6
0
    show_masks = False
    readonly = True
    annotation_dir = 'annotations'

    # optional filters to eliminate relevant position/timepoints
    timepoint_filters = [
        load_data.filter_excluded
    ]  #, elegant_filters.filter_live_animals] #, elegant_filters.filter_after_timepoint('2019-05-20t0000')] #, elegant_filters.select_worms(['15']), elegant_filters.filter_live_animals, elegant_filters.filter_by_stage('adult')] #, elegant_filters.filter_after_timepoint('2019-02-02t1200')]
    channels = [
        'bf'
    ]  #, 'gfp'] #, 'autofluorescence'] #, 'green_yellow_excitation_autofluorescence'] # First one is the one used to load poses when specified.

    # Only use one RisWidget for annotations
    rw_defined = 'rw' in globals()
    global rw
    if not rw_defined: rw = ris_widget.RisWidget()

    # Allows one to restart annotating in the same ris_widget window
    if hasattr(rw, 'annotator'):
        rw.annotator.close()
        del (rw.annotator)

    process_data.update_annotations(expt_dir)
    experiment_annotations = load_data.read_annotations(
        expt_dir, annotation_dir=annotation_dir)

    if timepoint_filters:
        experiment_annotations = load_data.filter_annotations(
            experiment_annotations,
            elegant_filters.compose_timepoint_filters(*timepoint_filters))