~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/covira/ims_params.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * ims_params.c
  3  *
  4  * gobal image stack parameters
  5  *
  6  */
  7 
  8 #include <tina/all_tina.h>
  9 #include <tina/brain.h>
 10 #include <tina/brainfuncs.h>
 11 
 12 Bool dofree = true;
 13 static double asnake = 0.25;
 14 static double alpha = 1.0;
 15 static double beta = 1.0;
 16 static double pressure = 1.0;
 17 static double scale = 4.0;
 18 static double level = 0;
 19 static double window = 1000;
 20 static Stats *stats = NULL;
 21 
 22 /*
 23 Get dofree flag which enables or disables freeing of passed images.
 24 */
 25 Bool ims_dofree_get(void)
 26 {
 27     return(dofree);
 28 }
 29 
 30 /*
 31 Set dofree flag, see ims_dofree_get
 32 */
 33 void ims_dofree_set(Bool newdofree)
 34 {
 35     dofree = newdofree;
 36 }
 37 
 38 /*
 39 Get snake angular resolution. Edge snakes will be constructed so
 40 that the average angle at knots is asnake (leads to small knot
 41 numbers for smooth snakes).
 42 */
 43 double ims_asnake_get(void)
 44 {
 45     return (asnake);
 46 }
 47 
 48 /*
 49 Set snake angular resolution, see ims_asnake_get.
 50 */
 51 void ims_asnake_set(double newasnake)
 52 {
 53     int i, z, zold;
 54     Imstack *ims = ims_imstack_get();
 55     if (ims == NULL)
 56         return;
 57     zold = ims_z_get();
 58     asnake = newasnake;
 59     for (z = ims->lz; z < ims->uz; z++)
 60     {
 61         Slice *slice = ims->slice[z];
 62         ims_z_set(z);
 63         ims_string_get();
 64         ims_string_changed();
 65         for (i = 0; i < NVOI; i++)
 66             if (slice->voi[i] != NULL)
 67                 slice->voi[i]->asnake = asnake;
 68     }
 69     ims_z_set(zold);
 70 }
 71 
 72 /*
 73 Get knot number of current spline.
 74 */
 75 int ims_nspline_get(void)
 76 {
 77     Spline2 *spline;
 78     Imstack *ims = ims_imstack_get();
 79     if (ims == NULL || (spline = VOI(ims)->spline) == NULL)
 80         return(0);
 81     return (spline->n);
 82 }
 83 
 84 /*
 85 Get snake tension parameter.
 86 */
 87 double ims_alpha_get(void)
 88 {
 89     return(alpha);
 90 }
 91 
 92 /*
 93 Set snake tension parameter.
 94 */
 95 void ims_alpha_set(double newalpha)
 96 {
 97     alpha = newalpha;
 98 }
 99 
100 /*
101 Get snake stiffness parameter.
102 */
103 double ims_beta_get(void)
104 {
105     return(beta);
106 }
107 
108 /*
109 Set snake stiffness parameter.
110 */
111 void ims_beta_set(double newbeta)
112 {
113     beta = newbeta;
114 }
115 
116 /*
117 Get statistical snake pressure parameter.
118 */
119 double ims_pressure_get(void)
120 {
121     return(pressure);
122 }
123 
124 /*
125 Set statistical snake pressure parameter.
126 */
127 void ims_pressure_set(double newpressure)
128 {
129     pressure = newpressure;
130 }
131 
132 /*
133 Get edge snake image smoothing (range) parameter.
134 */
135 double ims_scale_get(void)
136 {
137     return(scale);
138 }
139 
140 /*
141 Set edge snake image smoothing (range) parameter.
142 */
143 void ims_scale_set(double newscale)
144 {
145     scale = newscale;
146     ims_pots_free();
147 }
148 
149 /*
150 Get level l of range (l-w/2,l+w/2) outside which edge potential is cut-off.
151 */
152 double ims_level_get(void)
153 {
154     return(level);
155 }
156 
157 /*
158 Set level, see ims_level_get.
159 */
160 void ims_level_set(double newlevel)
161 {
162     level = newlevel;
163     ims_pots_free();
164 }
165 
166 /*
167 Get window w of range (l-w/2,l+w/2) outside which edge potential is cut-off.
168 */
169 double ims_window_get(void)
170 {
171     return(window);
172 }
173 
174 /*
175 Set window w, see ims_window_get.
176 */
177 void ims_window_set(double newwindow)
178 {
179     window = newwindow;
180     ims_pots_free();
181 }
182 
183 /*
184 Get mean intensity of acceptable region for statistical snake.
185 */
186 double ims_stats_mean_get()
187 {
188     if(stats == NULL)
189         return(0.0);
190     return(stats->mean);
191 }
192  
193 /*
194 Set mean intensity of acceptable region for statistical snake.
195 */
196 void ims_stats_mean_set(double mean)
197 {
198     if(stats == NULL)
199       stats = stats_make();
200     stats->mean = mean;
201 }
202  
203 /*
204 Get standard deviation of intensity of acceptable region for statistical snake.
205 */
206 double ims_stats_sigma_get()
207 {
208     if(stats == NULL)
209         return(0.0);
210     return(stats->sd);
211 }
212  
213 /*
214 Set standard deviation of intensity of acceptable region for statistical snake.
215 */
216 void ims_stats_sigma_set(double sigma)
217 {
218     if(stats == NULL)
219       stats = stats_make();
220     stats->sd = sigma;
221     stats->var = sqr(sigma);
222 }
223  
224 /*
225 Get structure describing statistics of acceptable region for statistical snake.
226 */
227 Stats *ims_stats_get()
228 {
229     return(stats);
230 }
231  
232 /*
233 Set structure describing statistics of acceptable region for statistical snake.
234 */
235 void ims_stats_set(Stats *newstats)
236 {
237     rfree(stats);
238     stats = newstats;
239 }
240 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.