Join/Login

Business Software

Open Source Software

For Vendors

Blog

About

More

Articles

Create

SourceForge Podcast

Site Documentation

Subscribe to our Newsletter

Support Request

For Vendors Help Create Join Login

Business Software

Open Source Software

SourceForge Podcast

Resources

Articles

Case Studies

Blog

Menu

Help

Create

Join

Login

Home

Browse

Iris

Calliope

Iris Calliope

2-photon scanning software

Brought to you by: heinmatt, kellgeor

Summary

Reviews

Support

Wiki

Tickets ▾

Bugs

Tasks

Feature Requests

SVN ▾

Iris Main

Auxiliary Code

Calliope

Discussion

Menu ▾ ▴

Browse Commits

Browse Files

[r1213]: / 08_RoiQuest / RoiQuest.m  Maximize  Restore  History

Download this file

172 lines (157 with data), 9.5 kB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

classdef RoiQuest < handle

properties

% Handles

gHandles = [] % Struct with handles of all the graphics obects in the GUI.

% For a list of all graphics handles see "gfx.createMainFigure()"

actiQuest = [] % Handle for the actiquest object

% Data related to the current recording

% -----------------------------------------------------------------

aDataFullPath = [] % Full path of the current aData file

aDataPath = [] % Path of the current aData file

aDataFileName = [] % Filename of the current aData file

currExpId = [] % Exp ID of the currently loaded recording

template = {} % Mean image of the stack (cell array, one for each Z layer)

act_map = {} % Max projection of the stack (cell array, one for each Z layer)

validArea = [] % Logical images (one for each Z layer) where ROIs are valid based on dx and dy displacement

ROIs = {} % Cell (for each z) of array of Roi objects. See class Roi.m

putativeROIs = [] % Array of putative Roi objects. See class Roi.m

ROItrans = {} % Cell containing info about global translation of this plane

imgs = {} % (3 by #Zlayers) Cell of different images for visualization (template, filtered, act_map)

imgNames = {... % Names to assign to the images in imgs

'Template',...

'Filtered Template',...

'Activity Map'}

currImgMedian = [] % Median of the currently displayed image (for dynamic thresholding quicker)

currImgStd = [] % Standard deviation of the currently displayed image (for dynamic thresholding quicker)

imgOvrl = [] % Image with labels for ROIs to use as overlay

ovrlOpacity = 0.35 % Opacity (0-1) of the overlay of ROIs

% For chronic Imaging

origAdataFullPath = '' % Full path of the aData file of the original recording

origTemplate = {} % Mean images (Z layers) of the original

origActMap = {} % Activity map of the original file

origImgs = {} % Same as imgs but for the original expId (if chronic recording)

showOriginal = false % Whether or not to show the original images instead of the current one (chronic)

% Data related to the GUI parameters and settings

% -----------------------------------------------------------------

EL = [] % ExpLog data for interacting with the experiments database

imgIdx = 1 % Index of the image (1st dim in self.imgs) to display now

currentZ = 1 % The current Z plane that is displayed for ROIing (2nd dim in self.imgs)

contrastMode = 'bestFit' % Can be 'bestFit', 'auto', or 'custom'

img_lo = [0,0,0] % Lower limit for adjusting image constrast (range 0-1) 3 Values for: template, filtTemplate and act_map

img_hi = [1,1,1] % Higher limit for adjusting image contrast (range 0-1) 3 Values for: template, filtTemplate and act_map

thr = [2.0, 0.3, 1.5] % Threshold for detecting cells. 3 Values for: template, filtTemplate and act_map

filterWinSize = [] % Size of the kernel in pixel for filtering the template image

filterType = 'legacy' % Can be 'legacy' (old filter) or 'updated' (the new filter georg hates)

cmap = gray(256) % RGB Colormap (256 by 3) to use in the display image

btnDownCoord = [] % Axis coordinates of the last time a mouse btn was pressed

btnUpCoord = [] % Axis coordinates of the last time a mouse btn was released

labCmap = gfx.getLabelsColormap() % Default colormap for the ROI labels

minRoiPix = 20 % Minimum number of pixels for a ROI (objects smaller are removed with bwareaopen)

isZoomedIn = false % If the visualization is zoomed-in for ROI selection or not

roiBg = [] % RGB image of a single color for displaying ROIs (in flat color mode)

roiSelBg = [] % RGB image of a single color for selecting ROIs

roiColorMode = 'flat' % "flat" (all ROIs same color) or "random" (ROIs have a random color), or "tags"

cellPoseModel = [] % Holds the Cellpose model for automatic cell detection

roiVisible = true % Toggle visibility of the ROIs overlay

roiNumberVisible = false % Toggle visibility of the ROI numbers

godCounter = 0 % Keypress counter for unlocking GodMode

showVectors = false % Wether to show movement vectors of ROIs

infoPos = 'tl' % Position of the thext info (tl, tr, bl, br)

infoPosCoord = [0,2,0]

end

methods

function self = RoiQuest(expId, opts)

% RoiQuest - Constructor for the RoiQuest application.

%

% self = RoiQuest(expId) constructs an instance of the RoiQuest

% application with the specified experiment ID (expId). This constructor

% initializes the GUI elements, assigns callbacks, loads AData files,

% retrieves information, and creates display images for visualization.

%

% Parameters:

% - expId (numeric): The experiment ID associated with the data to be

% analyzed.

%

% Returns:

% - self: The constructed RoiQuest object.

%

% Author: Leonardo Lupori

% Date: 01.03.2024

arguments

expId (1,1) {mustBeNumeric, isinteger}

opts.explog = getExpLog()

end

% Make sure only one GUI instance is called at a time

figs_img = findobj(allchild(groot), 'flat', 'Tag', 'fig_img');

if isempty(figs_img)

% Reset the seed for RNG so that randomized ROI colors are consistent

rng(42)

% Build all the graphical elements of the GUI

self.gHandles = gfx.createMainfigure();

% Save ExpLog as a property

self.EL = opts.explog;

% Assign all the callbacks to the buttons and menus

clbk.assignAllCallbacks(self);

% Get the full path of the adata file from the expID

[aDataFullPath,origAdataFullPath] = utils.expid2adataPath(expId);

msg = sprintf('Loading AData file:\n\t- %s', strrep(aDataFullPath, '\', '\\'));

utils.logMsg(msg)

% Get all the variables from the aData file and set them as

% properties in the object

clbk.getInfoFromAData(self, aDataFullPath);

clbk.getInfoFromOriginalAData(self, origAdataFullPath);

% Create the image handles to display

gfx.createDisplayImage(self)

% Update the image overlay

gfx.updateOverlayImage(self)

else

% Give back focus to the GUI if one instance already exists

figure(figs_img(1))

end

end

function loadNewExpid(self, expId)

% loadNewExpid - Load a new experiment ID (ExpID) and reset properties.

%

% loadNewExpid(expId) is a method used to load a new AData file

% corresponding to the specified ExpID in a MATLAB app object. This

% function resets certain properties to their default values and then

% retrieves information from the new AData file to update the app object.

%

% Parameters:

% - self: The MATLAB app object.

% - expId: The ID of the experiment to load. It must be a numeric integer.

arguments

self

expId (1,1) {mustBeNumeric, isinteger}

end

% Reset some properties that you might want reset when changing

% files to analyze

self.putativeROIs = [];

self.imgIdx = 1;

self.currentZ = 1;

self.contrastMode = 'bestFit';

self.img_lo = [0,0,0];

self.img_hi = [1,1,1];

self.thr = [2.0, 0.3, 1.5];

self.origAdataFullPath = '';

self.origTemplate = {};

self.origActMap = {};

self.origImgs = {};

self.gHandles.loadRoiOrig.Enable = false;

% Reset the seed for RNG so that randomized ROI colors are consistent

rng(42)

% Get the full path of the adata file from the expID

[AdPath, origAdPath] = utils.expid2adataPath(expId);

msg = sprintf('Loading new AData file:\n\t- %s', strrep(AdPath, '\', '\\'));

utils.logMsg(msg)

% Get all the variables from the aData file and set them as properties in the object

clbk.getInfoFromAData(self, AdPath);

clbk.getInfoFromOriginalAData(self, origAdPath);

% Recreate from scratch the display image and associated graphic objects

gfx.createDisplayImage(self)

% Update the overlay

gfx.updateOverlayImage(self)

utils.logMsg('Done loading. Happy ROIing :)')

end

end

end

SourceForge

Create a Project

Open Source Software

Business Software

Top Downloaded Projects

Company

About

Team

SourceForge Headquarters
225 Broadway Suite 1600
San Diego, CA 92101
+1 (858) 422-6466

Resources

Support

Site Documentation

Site Status

SourceForge Reviews

© 2025 Slashdot Media. All Rights Reserved.

Terms Privacy Opt Out Advertise

×
Want the latest updates on software, tech news, and AI?

Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.

Submit