Code Monkey home page Code Monkey logo

drawing-rois-without-gui's Introduction

Drawing ROIs without GUI

Drawing ROIs with a non-graphical user interface in Matlab

Drawing ROIs is a repetitive task when analyzing calcium imaging data. Despite automatization attempts (e.g., http://neurofinder.codeneuro.org/), most of the time drawing the ROIs manually is still the best solution. This script tries to simplify and streamline manual drawing of ROIs.

Quick start

To try out the script provided here,

  1. Clone the repository locally
  2. Open Demo_Analysis.m in Matlab
  3. Follow the notebook instructions and load the (small) demo calcium movie excerpt
  4. Once the graphical user interface appears: a) hit the f key and draw ROI b) use mouse to navigate.

The idea: using callback functions without GUI

In order to make this task as easy and intuitive as possible, I used a non-graphical user interface that relies on the user's knowledge of which keys and which mouse buttons to press (inspired by the Google Maps interface). I described the idea of this non-graphical user interface on my blog. The callback functions are defined in this subscript.

Drawing ROIs with a non-graphical user interface

Overview of key-strokes

q : switch to anatomy only
w : switch to dF/F map (response)
e : switch to dF/F map (maximum)
r : switch to anamy overlayed with selected ROIs
t : switch to map of ROIs only
y : switch to map of local correlations

Mouse-click right : full view zoom
Mouse-click middle : pan (move mouse)
Scroll-wheel : zoom in and out

f : mouse-click left draws ROI outline
d : mouse-click left deletes ROI
g : mouse-click left shifts existing nearby ROI
z : mouse-click left automatically selects a circular ROI
x : mouse-click left automatically selects a ROI based on local correlations
1 to 9 : selects ROI size for semi-automatic ROI selection (x, z)
v : mouse-click left plots a map of local correlations of all image pixels to the selected location (cf. Junek et al.)

Close figure window : save selected ROIs and timetraces to the Matlab workspace.

'Demo_analysis.m' explained

The main script (Demo_Analysis.m) loads a 3D stack into the RAM and performs a couple of pre-processing steps before opening the non-graphical user interface (which is basically a simple image opened in Matlab, glued to a couple of key-stroke- and mouse-gesture-specific callback functions). The video linked above gives an overview over the keys (=shortcuts) and how to use them on a real calcium imaging dataset.

To adapt this script to your data, you want to change 'Demo_Analysis.m', not the rest of the code. This program can be used, as long as your data fit into the RAM. For larger single calcium recordings, other methods (that use only average images of anatomy or binned videos) must be used.

Variations of this script have been used to extract activity of neurons from calcium imaging data in the following papers: paper 1, paper 2, paper 3.

drawing-rois-without-gui's People

Contributors

ptrrupprecht avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.