1 package com.github.celldynamics.quimp.plugin.protanalysis;
2
3 import java.awt.Color;
4
5 import org.apache.commons.lang3.mutable.MutableBoolean;
6 import org.apache.commons.lang3.mutable.MutableInt;
7 import org.scijava.vecmath.Point2d;
8
9 import com.github.celldynamics.quimp.filesystem.IQuimpSerialize;
10 import com.github.celldynamics.quimp.plugin.AbstractPluginOptions;
11 import com.github.celldynamics.quimp.plugin.qanalysis.STmap;
12
13 /**
14 * Hold all configuration for Protrusion Analysis Module.
15 *
16 * @author p.baniukiewicz
17 *
18 */
19 public class ProtAnalysisOptions extends AbstractPluginOptions implements IQuimpSerialize {
20
21 /**
22 * Color of selected point on the outline when hoover the mouse.
23 */
24 public static Color pointColor = Color.CYAN; // box color
25 /**
26 * Color of selected point.
27 */
28 public static Color staticPointColor = Color.YELLOW; // box color
29 /**
30 * Size of the point when selected.
31 */
32 public static int staticPointSize = 20;
33 /**
34 * Size of the point when hoover.
35 */
36 public static int pointSize = 10; // box size
37 /**
38 * Prefix added to Roi in ROI Manager.
39 */
40 public static final String roiPrefix = "pa_cell_";
41 /**
42 * Radius of circles plotted by tool.
43 */
44 public double circleRadius = 10;
45 /**
46 * Vale for static plot.
47 *
48 * @see #plotStaticDynamic
49 */
50 public static final int PLOT_STATIC = 0;
51 /**
52 * Vale for dynamic plot.
53 *
54 * @see #plotStaticDynamic
55 */
56 public static final int PLOT_DYNAMIC = 1;
57 /**
58 * Channel for tables.
59 */
60 public static final int CH1 = 0;
61 /**
62 * Channel for tables.
63 */
64 public static final int CH2 = 1;
65 /**
66 * Channel for tables.
67 */
68 public static final int CH3 = 2;
69 /**
70 * Whether to show tracks in new plot or in embedded in GUI. VisualTracking UI Option.
71 */
72 public MutableBoolean chbNewImage = new MutableBoolean(true);
73 /**
74 * Whether to flatten static track. VisualTracking UI Option.
75 */
76 public MutableBoolean chbFlattenStaticTrackImage = new MutableBoolean(false);
77 /**
78 * Plot dynamic or static plots. VisualTracking UI Option.
79 *
80 * <p>0 - static, 1 - dynamic
81 *
82 * @see #PLOT_DYNAMIC
83 * @see #PLOT_STATIC
84 */
85 public MutableInt plotStaticDynamic = new MutableInt(PLOT_STATIC);
86 /**
87 * Apply track smoothing. VisualTracking UI Option.
88 */
89 public MutableBoolean chbSmoothTracks = new MutableBoolean(false);
90 /**
91 * Show tracked point on dynamic track. VisualTracking UI Option.
92 */
93 public MutableBoolean chbShowPoint = new MutableBoolean(true);
94 /**
95 * Show track on dynamic track. VisualTracking UI Option.
96 */
97 public MutableBoolean chbShowTrack = new MutableBoolean(true);
98 /**
99 * Show tracks on motility map. VisualTracking UI Option.
100 */
101 public MutableBoolean chbShowTrackMotility = new MutableBoolean(true);
102 /**
103 * Cell used for generating plots. VisualTracking UI Option.
104 */
105 public MutableInt selActiveCellPlot = new MutableInt(0);
106 /**
107 * Cell used for generating maps. VisualTracking UI Option.
108 */
109 public MutableInt selActiveCellMap = new MutableInt(0);
110 /**
111 * Active channel for plotting maps. VisualTracking UI Option.
112 */
113 public MutableInt selActiveChannel = new MutableInt(CH1);
114 /**
115 * Plot map. VisualTracking UI Option.
116 */
117 public MutableBoolean chbXcentrPlot = new MutableBoolean(false);
118 /**
119 * Plot map. VisualTracking UI Option.
120 */
121 public MutableBoolean chbYcentrPlot = new MutableBoolean(false);
122 /**
123 * Plot map. VisualTracking UI Option.
124 */
125 public MutableBoolean chbDisplPlot = new MutableBoolean(false);
126 /**
127 * Plot map. VisualTracking UI Option.
128 */
129 public MutableBoolean chbDistPlot = new MutableBoolean(false);
130 /**
131 * Plot map. VisualTracking UI Option.
132 */
133 public MutableBoolean chbPersistencePlot = new MutableBoolean(false);
134 /**
135 * Plot map. VisualTracking UI Option.
136 */
137 public MutableBoolean chbSpeedPlot = new MutableBoolean(false);
138 /**
139 * Plot map. VisualTracking UI Option.
140 */
141 public MutableBoolean chbPerimPlot = new MutableBoolean(false);
142 /**
143 * Plot map. VisualTracking UI Option.
144 */
145 public MutableBoolean chbElongPlot = new MutableBoolean(false);
146 /**
147 * Plot map. VisualTracking UI Option.
148 */
149 public MutableBoolean chbCircPlot = new MutableBoolean(false);
150 /**
151 * Plot map. VisualTracking UI Option.
152 */
153 public MutableBoolean chbAreaPlot = new MutableBoolean(false);
154 /**
155 * Plot 2D. VisualTracking UI Option.
156 */
157 public MutableBoolean chbTotFluPlot = new MutableBoolean(false);
158 /**
159 * Plot 2D. VisualTracking UI Option.
160 */
161 public MutableBoolean chbMeanFluPlot = new MutableBoolean(false);
162 /**
163 * Plot 2D. VisualTracking UI Option.
164 */
165 public MutableBoolean chbCortexWidthPlot = new MutableBoolean(false);
166 /**
167 * Plot 2D. VisualTracking UI Option.
168 */
169 public MutableBoolean chbCytoAreaPlot = new MutableBoolean(false);
170 /**
171 * Plot 2D. VisualTracking UI Option.
172 */
173 public MutableBoolean chbTotalCytoPlot = new MutableBoolean(false);
174 /**
175 * Plot 2D. VisualTracking UI Option.
176 */
177 public MutableBoolean chbMeanCtfPlot = new MutableBoolean(false);
178 /**
179 * Plot 2D. VisualTracking UI Option.
180 */
181 public MutableBoolean chbMeanCytoPlot = new MutableBoolean(false);
182 /**
183 * Plot 2D. VisualTracking UI Option.
184 */
185 public MutableBoolean chbCortexAreaPlot = new MutableBoolean(false);
186 /**
187 * Plot 2D. VisualTracking UI Option.
188 */
189 public MutableBoolean chbTotalCtf2Plot = new MutableBoolean(false);
190 /**
191 * Plot 2D. VisualTracking UI Option.
192 */
193 public MutableBoolean chbManCtfPlot = new MutableBoolean(false);
194 /**
195 * Hold configuration for plotting outlines of cells on stack of images.
196 *
197 * @see ActionTrackPoints
198 */
199 public OutlinesToImage selOutlineColoring = new OutlinesToImage();
200 /**
201 * Gradient point for polar plot.
202 */
203 public Point2d gradientPoint = new Point2d(0, 0);
204 /**
205 * Indicate that pick point mode is on.
206 *
207 * @see CustomCanvas#mouseClicked(java.awt.event.MouseEvent)
208 */
209 public MutableBoolean bnGradientPickActive = new MutableBoolean(false);
210 /**
211 * Save tracks to csv file.
212 *
213 * <p>Currently not available from UI. Maps are saved always under fixed name.
214 *
215 * @see ActionTrackPoints
216 */
217 public MutableBoolean saveTracks = new MutableBoolean(true);
218
219 /**
220 * Sensitivity of maximum detection.
221 */
222 public double noiseTolerance = 1.5;
223 /**
224 * Percentage of drop from maximum of motility map to consider point in tracking line.
225 */
226 public double dropValue = 1;
227
228 /**
229 * Plot types supported by
230 * {@link TrackVisualisation.Stack#addOutlinesToImage(STmap, ProtAnalysisOptions)}.
231 * <ol>
232 * <li>MOTILITY - only motility based outline.
233 * <li>CONVEXITY - only convexity based outline.
234 * <li>CONVANDEXP - parts that are convex and expanding.
235 * <li>CONCANDRETR - parts that are concave and retracting.
236 * <li>BOTH - combines CONVANDEXP and CONCANDRETR
237 * </ol>
238 *
239 * @author p.baniukiewicz
240 *
241 */
242 public enum OutlinePlotTypes {
243
244 /**
245 * Just pure outline.
246 */
247 UNIFORM,
248 /**
249 * The motility only.
250 */
251 MOTILITY,
252 /**
253 * The convexity only.
254 */
255 CONVEXITY,
256 /**
257 * Convex and expanding parts.
258 */
259 CONVANDEXP,
260 /**
261 * Concave and retracting parts.
262 */
263 CONCANDRETR,
264 /**
265 * CONCANDRETR + CONVANDEXP.
266 */
267 BOTH
268 }
269
270 /**
271 * Types of gradient points.
272 * <ol>
273 * <li>SCREENPOINT - any point clicked on image. Given as {x,y} coordinates
274 * <li>OUTLINEPOINT - point on outline. Given as number of this point on perimeter.
275 * <li>....
276 * </ol>
277 *
278 * @author p.baniukiewicz
279 *
280 */
281 public enum GradientType {
282 /**
283 * Left bottom corner.
284 */
285 LB_CORNER,
286 /**
287 * Left upper corner.
288 */
289 LU_CORNER,
290 /**
291 * Right bottom corner.
292 */
293 RB_CORNER,
294 /**
295 * Right upper corner.
296 */
297 RU_CORNER
298 }
299
300 /**
301 * Configuration of plotting outlines of cells on stack of images.
302 *
303 * @author p.baniukiewicz
304 * @see TrackVisualisation.Stack#addOutlinesToImage(STmap,ProtAnalysisOptions)
305 */
306 class OutlinesToImage implements IEnumDataType {
307 /**
308 * Default color of motility outline.
309 */
310 public Color motColor = Color.BLUE;
311 /**
312 * Default color of convexity outline.
313 */
314 public Color convColor = Color.RED;
315 /**
316 * Default color of outline.
317 */
318 public Color defColor = Color.GRAY;
319 /**
320 * Threshold above to which plot motility on outline.
321 */
322 public double motThreshold;
323 /**
324 * Threshold above to which plot convexity on outline.
325 */
326 public double convThreshold;
327 /**
328 * Define type of plot of outline.
329 */
330 public OutlinePlotTypes plotType;
331
332 /**
333 * Set default values.
334 */
335 public OutlinesToImage() {
336 motThreshold = 0;
337 convThreshold = 0;
338 plotType = OutlinePlotTypes.UNIFORM;
339 }
340
341 @Override
342 public void setCurrent(Enum<?> val) {
343 plotType = (OutlinePlotTypes) val;
344 }
345 }
346
347 /**
348 * Base Interface used by {@link ActionUpdateOptionsEnum}.
349 *
350 * <p>Every filed that uses Enum should implement this.
351 *
352 * @author p.baniukiewicz
353 *
354 */
355 interface IEnumDataType {
356 public void setCurrent(Enum<?> val);
357 }
358
359 /**
360 * Instantiates a new prot analysis config.
361 */
362 public ProtAnalysisOptions() {
363 }
364
365 @Override
366 public void beforeSerialize() {
367 }
368
369 @Override
370 public void afterSerialize() throws Exception {
371 }
372
373 }