View Javadoc
1   package com.github.celldynamics.quimp.plugin.ana;
2   
3   import java.io.File;
4   
5   import com.github.celldynamics.quimp.Outline;
6   import com.github.celldynamics.quimp.QParams;
7   import com.github.celldynamics.quimp.filesystem.converter.FormatConverter;
8   import com.github.celldynamics.quimp.utils.QuimpToolsCollection;
9   
10  /**
11   * Container class for parameters concerned with ANA analysis.
12   * 
13   * <p>This class is serialized through
14   * {@link com.github.celldynamics.quimp.filesystem.ANAParamCollection}.
15   * The structure of transient and non-transient fields must be reflected in FormatConverter. Note
16   * that there is similar class {@link AnaOptions} which keeps parameters related to macros.
17   * 
18   * @author rtyson
19   * @author p.baniukiewicz
20   * @see FormatConverter#doConversion()
21   * @see AnaOptions
22   */
23  public class ANAp {
24  
25    /**
26     * Array of fluorescent channels.
27     */
28    public File[] fluTiffs;
29    /**
30     * Input file reference.
31     * 
32     * <p>snQP file if run from paQP.
33     */
34    public transient File inFile;
35    /**
36     * Output snQP file reference (the same as {@link #inFile}.
37     */
38    public transient File outFile;
39    /**
40     * Reference to Stats file.
41     * 
42     * <p>Used in QCONF/paQP.
43     */
44    public transient File statFile;
45    /**
46     * Atomic step during contour shrinking.
47     */
48    public final transient double stepRes = 0.04; // step size in pixels
49    /**
50     * Angle to freeze neighbouring vertexes.
51     */
52    public final transient double freezeTh = 1;
53    /**
54     * Angle threshold.
55     * 
56     * @see Outline#scaleOutline(double, double, double, double)
57     */
58    public final transient double angleTh = 0.1;
59    /**
60     * Frame resolution.
61     * 
62     * @see com.github.celldynamics.quimp.Outline#setResolution(double)
63     */
64    public final transient double oneFrameRes = 1;
65    /**
66     * Image scale.
67     * 
68     * <p>Initialised by {@link #setup(QParams)} from loaded QCONF/paQP.
69     */
70    public transient double scale = 1.0;
71    /**
72     * Frame interval.
73     * 
74     * <p>Initialised by {@link #setup(QParams)} from loaded QCONF/paQP.
75     */
76    public transient double frameInterval;
77    /**
78     * Frame range.
79     * 
80     * <p>Initialised by {@link #setup(QParams)} from loaded QCONF/paQP.
81     */
82    public transient int startFrame;
83    /**
84     * Frame range.
85     * 
86     * <p>Initialised by {@link #setup(QParams)} from loaded QCONF/paQP.
87     */
88    public transient int endFrame;
89  
90    /**
91     * The present data.
92     */
93    transient int[] presentData;
94  
95    /**
96     * The cleared.
97     */
98    transient boolean cleared;
99  
100   /**
101    * The no data.
102    */
103   transient boolean noData;
104 
105   /**
106    * The use loc from ch.UI setting
107    */
108   transient int useLocFromCh;
109 
110   private double cortexWidthPixel; // in pixels
111   private double cortexWidthScale; // at scale
112 
113   /**
114    * Default constructor.
115    */
116   public ANAp() {
117     fluTiffs = new File[3];
118     fluTiffs[0] = new File("/");
119     fluTiffs[1] = new File("/");
120     fluTiffs[2] = new File("/");
121     presentData = new int[3];
122     setCortextWidthScale(0.7); // default value
123   }
124 
125   /**
126    * Copy constructor.
127    * 
128    * @param src source to copy from
129    */
130   public ANApANAp" href="../../../../../../com/github/celldynamics/quimp/plugin/ana/ANAp.html#ANAp">ANAp(ANAp src) {
131     this.inFile = new File(src.inFile.getAbsolutePath());
132     this.outFile = new File(src.outFile.getAbsolutePath());
133     this.statFile = new File(src.statFile.getAbsolutePath());
134     this.cortexWidthPixel = src.cortexWidthPixel;
135     this.cortexWidthScale = src.cortexWidthScale;
136     this.scale = src.scale;
137     this.frameInterval = src.frameInterval;
138     this.startFrame = src.startFrame;
139     this.endFrame = src.endFrame;
140     this.presentData = new int[src.presentData.length];
141     System.arraycopy(src.presentData, 0, this.presentData, 0, src.presentData.length);
142     this.cleared = src.cleared;
143     this.noData = src.noData;
144     this.useLocFromCh = src.useLocFromCh;
145 
146     this.fluTiffs = new File[src.fluTiffs.length];
147     for (int i = 0; i < fluTiffs.length; i++) {
148       fluTiffs[i] = new File(src.fluTiffs[i].getPath());
149     }
150 
151   }
152 
153   /**
154    * Initiates ANAp class with parameters copied from BOA analysis.
155    * 
156    * @param qp reference to QParams container (master file and BOA params)
157    */
158   void setup(QParams qp) {
159     inFile = qp.getSnakeQP();
160     outFile = new File(inFile.getAbsolutePath()); // output file (.snQP) file
161     statFile = new File(qp.getStatsQP().getAbsolutePath()); // output file
162     // (.stQP.csv) file
163     scale = qp.getImageScale();
164     frameInterval = qp.getFrameInterval();
165     setCortextWidthScale(qp.cortexWidth);
166     startFrame = qp.getStartFrame();
167     endFrame = qp.getEndFrame();
168     cleared = false;
169     noData = true;
170   }
171 
172   /**
173    * Set cortex scale.
174    * 
175    * @param c the scale
176    */
177   public void setCortextWidthScale(double c) {
178     cortexWidthScale = c;
179     cortexWidthPixel = QuimpToolsCollection.distanceFromScale(cortexWidthScale, scale);
180   }
181 
182   /**
183    * Get cortex width in pixels.
184    * 
185    * @return the cortexWidthPixel
186    */
187   public double getCortexWidthPixel() {
188     return cortexWidthPixel;
189   }
190 
191   /**
192    * Get cortex scale.
193    * 
194    * @return cortexWidthScale
195    */
196   public double getCortexWidthScale() {
197     return cortexWidthScale;
198   }
199 
200   /**
201    * Set cortex widh in pixels.
202    * 
203    * @param cortexWidthPixel the cortexWidthPixel to set
204    */
205   public void setCortexWidthPixel(double cortexWidthPixel) {
206     this.cortexWidthPixel = cortexWidthPixel;
207   }
208 }