1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 c-style: "K&R" -*- */
3 /*----------------------------------------------------------------------
5 gpiv - Graphic program for Particle Image Velocimetry, based on gtk/gnome
8 Copyright (C) 2002 Gerber van der Graaf
10 This file is part of gpiv.
12 Gpiv is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2, or (at your option)
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 ----------------------------------------------------------------------*/
29 * (callback) functions for Piv evaluation window/tabulator
31 * Revision 1.2 2003-06-27 13:47:26 gerber
32 * display ruler, line/point evaluation
34 * Revision 1.1.1.1 2003/06/17 17:10:52 gerber
47 alloc_bufmem_per_intarea(int index_y
,
52 /* --------------------------------------------------------------------
53 Memory allocation of covariance in a packed interrogation area array */
56 gpiv_piv_bounds_cov(&gpd
->cov
[index_y
][index_x
],
57 int_size_0
, image_par
);
59 gpd
->cov
[index_y
][index_x
].z
=
60 gpiv_matrix(gpd
->cov
[index_y
][index_x
].z_rl
,
61 gpd
->cov
[index_y
][index_x
].z_rh
,
62 gpd
->cov
[index_y
][index_x
].z_cl
,
63 gpd
->cov
[index_y
][index_x
].z_ch
);
66 * Memory allocation of interrogation area's
68 gpd
->intreg1
[index_y
][index_x
] =
69 gpiv_matrix(0, int_size_0
- 1, 0, int_size_0
- 1);
70 gpd
->intreg2
[index_y
][index_x
] =
71 gpiv_matrix(0, int_size_0
- 1, 0, int_size_0
- 1);
72 memset(gpd
->intreg1
[index_y
][index_x
][0], 0,
73 (sizeof(float)) * int_size_0
* int_size_0
);
74 memset(gpd
->intreg2
[index_y
][index_x
][0], 0,
75 (sizeof(float)) * int_size_0
* int_size_0
);
81 free_bufmem_per_intarea(int index_y
,
87 gpiv_piv_bounds_cov(&gpd
->cov
[index_y
][index_x
],
88 int_size_0
, image_par
);
90 gpiv_free_matrix(gpd
->cov
[index_y
][index_x
].z
,
91 gpd
->cov
[index_y
][index_x
].z_rl
,
92 gpd
->cov
[index_y
][index_x
].z_rh
,
93 gpd
->cov
[index_y
][index_x
].z_cl
,
94 gpd
->cov
[index_y
][index_x
].z_ch
);
96 gpiv_free_matrix(gpd
->intreg1
[index_y
][index_x
], 0, int_size_0
- 1,
99 gpiv_free_matrix(gpd
->intreg2
[index_y
][index_x
], 0, int_size_0
- 1,
102 gpd
->intreg1
[index_y
][index_x
] = NULL
;
103 gpd
->intreg2
[index_y
][index_x
] = NULL
;
109 * Piv evaluation window/tabulator callbacks
113 on_radiobutton_piv_mouse(GtkWidget
* widget
,
116 m_select
= atoi(gtk_object_get_data(GTK_OBJECT(widget
),
119 if (m_select
== NO_MS
) {
120 piv_eval_par
.int_geo
= AOI
;
121 } else if (m_select
== AOI_MS
) {
122 piv_eval_par
.int_geo
= AOI
;
123 } else if (m_select
== SINGLE_POINT_MS
) {
124 piv_eval_par
.int_geo
= POINT
;
125 } else if (m_select
== VLINE_MS
) {
126 piv_eval_par
.int_geo
= LINE_C
;
127 } else if (m_select
== HLINE_MS
) {
128 piv_eval_par
.int_geo
= LINE_R
;
129 } else if (m_select
== SINGLE_AREA_MS
||
130 m_select
== DRAG_MS
) {
131 piv_eval_par
.int_geo
= POINT
;
138 on_radiobutton_piv_mouse1_enter(GtkWidget
* widget
,
141 GpivConsole
*gpiv
= gtk_object_get_data(GTK_OBJECT(widget
), "gpiv");
142 gchar
*msg
= _("No mouse activity within displayer");
143 gnome_appbar_set_status(GNOME_APPBAR(gpiv
->appbar
), msg
);
148 on_radiobutton_piv_mouse2_enter(GtkWidget
* widget
,
151 GpivConsole
*gpiv
= gtk_object_get_data(GTK_OBJECT(widget
), "gpiv");
152 gchar
*msg
= _("Selects an area within the image to be analyzed");
153 gnome_appbar_set_status(GNOME_APPBAR(gpiv
->appbar
), msg
);
158 on_radiobutton_piv_mouse3_enter(GtkWidget
* widget
,
161 GpivConsole
*gpiv
= gtk_object_get_data(GTK_OBJECT(widget
), "gpiv");
162 gchar
*msg
= _("Piv evaluation at a single interrogation area. "
163 "Conserves other existing data");
164 gnome_appbar_set_status(GNOME_APPBAR(gpiv
->appbar
), msg
);
169 on_radiobutton_piv_mouse4_enter(GtkWidget
* widget
,
172 GpivConsole
*gpiv
= gtk_object_get_data(GTK_OBJECT(widget
), "gpiv");
173 gchar
*msg
= _("Piv evaluation at a single point in the image. "
174 "Rejects all existing data!!");
175 gnome_appbar_set_status(GNOME_APPBAR(gpiv
->appbar
), msg
);
180 on_radiobutton_piv_mouse5_enter(GtkWidget
* widget
,
183 GpivConsole
*gpiv
= gtk_object_get_data(GTK_OBJECT(widget
), "gpiv");
184 gchar
*msg
= _("Displaces a single interrogation area and analyzes");
185 gnome_appbar_set_status(GNOME_APPBAR(gpiv
->appbar
), msg
);
190 on_radiobutton_piv_mouse6_enter(GtkWidget
* widget
,
193 GpivConsole
*gpiv
= gtk_object_get_data(GTK_OBJECT(widget
), "gpiv");
194 gchar
*msg
= _("Evaluation at a vertical line. ");
195 gnome_appbar_set_status(GNOME_APPBAR(gpiv
->appbar
), msg
);
200 on_radiobutton_piv_mouse7_enter(GtkWidget
* widget
,
203 GpivConsole
*gpiv
= gtk_object_get_data(GTK_OBJECT(widget
), "gpiv");
204 gchar
*msg
= _("Evaluation at a horizontal line. ");
205 gnome_appbar_set_status(GNOME_APPBAR(gpiv
->appbar
), msg
);
210 on_spinbutton_piv_int(GtkSpinButton
* widget
,
213 PivEval
* eval
= gtk_object_get_data(GTK_OBJECT(widget
), "eval");
229 /* eval = gtk_object_get_data(GTK_OBJECT(widget), "eval"); */
233 /* Display display_act; */
234 /* display_act = gtk_object_get_data(widget, display_act); */
237 * Select which variable has to be modified
239 setby_spinbutton
= 1;
240 var_type
= atoi(gtk_object_get_data(GTK_OBJECT(widget
), "var_type"));
242 if (var_type
== COL_START
) {
243 piv_eval_par
.col_start
= gtk_spin_button_get_value_as_int(widget
);
245 } else if (var_type
== COL_END
) {
246 piv_eval_par
.col_end
= gtk_spin_button_get_value_as_int(widget
);
248 } else if (var_type
== PRE_SHIFT_COL
) {
249 piv_eval_par
.pre_shift_col
= gtk_spin_button_get_value_as_int(widget
);
251 } else if (var_type
== ROWSTART
) {
252 piv_eval_par
.row_start
= gtk_spin_button_get_value_as_int(widget
);
254 } else if (var_type
== ROWEND
) {
255 piv_eval_par
.row_end
= gtk_spin_button_get_value_as_int(widget
);
257 } else if (var_type
== PRESHIFTROW
) {
258 piv_eval_par
.pre_shift_row
= gtk_spin_button_get_value_as_int(widget
);
260 } else if (var_type
== INT_SIZE_1
) {
261 piv_eval_par
.int_size_1
= gtk_spin_button_get_value_as_int(widget
);
264 GTK_ADJUSTMENT(eval
->spinbutton_adj_intsize2
)->lower
=
265 (gfloat
) piv_eval_par
.int_size_1
;
266 GTK_ADJUSTMENT(eval
->spinbutton_adj_intsize2
)->upper
=
268 gtk_adjustment_changed (GTK_ADJUSTMENT(eval
->spinbutton_adj_intsize2
));
269 gtk_adjustment_set_value(GTK_ADJUSTMENT(eval
->spinbutton_adj_intsize2
),
270 (gfloat
) piv_eval_par
.int_size_1
);
273 * Adjust radio buttons for in. size 1
275 if (piv_eval_par
.int_size_1
== 16) {
276 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
277 (eval
->radiobutton_intsize1_2
),
280 } else if (piv_eval_par
.int_size_1
== 32) {
281 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
282 (eval
->radiobutton_intsize1_3
), TRUE
);
284 } else if (piv_eval_par
.int_size_1
== 64) {
285 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
286 (eval
->radiobutton_intsize1_4
), TRUE
);
287 } else if (piv_eval_par
.int_size_1
== 128) {
288 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
289 (eval
->radiobutton_intsize1_5
), TRUE
);
293 } else if (var_type
== INT_SIZE_2
) {
294 piv_eval_par
.int_size_2
= gtk_spin_button_get_value_as_int(widget
);
295 if (piv_eval_par
.int_size_2
> piv_eval_par
.int_size_1
) {
296 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
297 (eval
->checkbutton_zerooff
),
300 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
301 (eval
->checkbutton_zerooff
),
306 * Adjust radio buttons for in. size 2
308 if (piv_eval_par
.int_size_2
== 16) {
309 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
310 (eval
->radiobutton_intsize2_2
), TRUE
);
311 } else if (piv_eval_par
.int_size_2
== 32) {
312 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
313 (eval
->radiobutton_intsize2_3
), TRUE
);
314 } else if (piv_eval_par
.int_size_2
== 64) {
315 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
316 (eval
->radiobutton_intsize2_4
), TRUE
);
317 } else if (piv_eval_par
.int_size_2
== 128) {
318 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
319 (eval
->radiobutton_intsize2_5
), TRUE
);
322 } else if (var_type
== INT_SHIFT
) {
323 piv_eval_par
.int_shift
= gtk_spin_button_get_value_as_int(widget
);
325 if (piv_eval_par
.int_shift
== 8) {
326 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
327 (eval
->radiobutton_intshift_1
), TRUE
);
328 } else if (piv_eval_par
.int_shift
== 16) {
329 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
330 (eval
->radiobutton_intshift_2
), TRUE
);
331 } else if (piv_eval_par
.int_shift
== 32) {
332 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
333 (eval
->radiobutton_intshift_3
), TRUE
);
334 } else if (piv_eval_par
.int_shift
== 64) {
335 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
336 (eval
->radiobutton_intshift_4
), TRUE
);
337 } else if (piv_eval_par
.int_shift
== 128) {
338 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
339 (eval
->radiobutton_intshift_5
), TRUE
);
343 if (display_act
!= NULL
) {
344 nx
= display_act
->intreg
.data
.nx
;
345 ny
= display_act
->intreg
.data
.ny
;
346 gpiv_piv_count_pivdata_fromimage(&l_intreg
, image_par
, piv_eval_par
);
350 * For some operations the intregs have to be renewed unconditionally,
351 * for others only in case if the number of intregs has been changed
353 if (var_type
== COL_START
|| var_type
== COL_END
354 || var_type
== ROWSTART
|| var_type
== ROWEND
) {
355 if (nx
== l_intreg
.nx
356 && ny
== l_intreg
.ny
) {
361 if (renew
== 1 && display_act
->display_intregs
== 1) {
362 destroy_all_intregs(display_act
);
363 create_all_intregs(display_act
);
366 setby_spinbutton
= 0;
372 on_radiobutton_piv_int(GtkWidget
* widget
,
375 gint int_size_1_tmp
, display_intregs_tmp
= 0,
376 nx_tmp
= 0, ny_tmp
= 0;
377 /* gint setby_spinbutton = atoi(gtk_object_get_data(GTK_OBJECT(widget), */
378 /* "setby_spinbutton")); */
379 PivEval
*eval
= gtk_object_get_data(GTK_OBJECT(widget
), "eval");
380 Display
*disp
= display_act
;
389 nx
= disp
->intreg
.data
.nx
;
390 ny
= disp
->intreg
.data
.ny
;
396 if (GTK_TOGGLE_BUTTON(widget
)->active
) {
397 var_type
= atoi(gtk_object_get_data(GTK_OBJECT(widget
),
401 * Select which variable has to be modified
403 if (var_type
== SIZE_1
) {
404 int_size_1_tmp
= piv_eval_par
.int_size_1
;
405 piv_eval_par
.int_size_1
= atoi(gtk_object_get_data
409 * switch off d_intregs temporarly
412 display_intregs_tmp
= disp
->display_intregs
;
413 disp
->display_intregs
= 0;
417 adjust_radiobutton_piv_int(eval
, piv_eval_par
.int_size_1
);
420 * return d_intregs to original value
423 disp
->display_intregs
= display_intregs_tmp
;
428 * Reset weight and zero_off
430 if (piv_eval_par
.int_size_2
> int_size_1_tmp
) {
431 /* gtk_widget_set_sensitive(eval->checkbutton_zerooff, TRUE); */
432 /* gtk_widget_set_sensitive(checkbutton_piv_weightkernel, TRUE); */
433 if (zero_off_tmp
== 0) {
434 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
435 (eval
->checkbutton_zerooff
),
437 gtk_widget_set_sensitive(eval
->checkbutton_zerooff
, TRUE
);
438 gtk_widget_set_sensitive(eval
->checkbutton_weightkernel
,
440 if (weight_tmp
== 0) {
441 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
442 (eval
->checkbutton_weightkernel
),
444 gtk_widget_set_sensitive(eval
->checkbutton_zerooff
,
446 gtk_widget_set_sensitive(eval
->checkbutton_weightkernel
, TRUE
);
448 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
449 (eval
->checkbutton_weightkernel
),
451 gtk_widget_set_sensitive(eval
->checkbutton_zerooff
,
453 gtk_widget_set_sensitive(eval
->checkbutton_weightkernel
,
457 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
458 (eval
->checkbutton_zerooff
),
460 gtk_widget_set_sensitive(eval
->checkbutton_zerooff
, TRUE
);
461 gtk_widget_set_sensitive(eval
->checkbutton_weightkernel
,
467 * Also calls on_spinbutton_piv_int, which, on its turn, may call this function
468 * again resulting into an infinite loop
470 gtk_spin_button_set_value(GTK_SPIN_BUTTON
471 (eval
->spinbutton_intsize1
),
472 piv_eval_par
.int_size_1
);
475 } else if (var_type
== SIZE_2
) {
476 piv_eval_par
.int_size_2
= atoi(gtk_object_get_data(GTK_OBJECT(widget
),
482 gtk_adjustment_set_value(GTK_ADJUSTMENT
483 (eval
->spinbutton_adj_intsize2
),
484 (gfloat
) piv_eval_par
.int_size_2
);
486 * Save origanal settings of weight and zero_off for later resetting
488 if (piv_eval_par
.int_size_2
> piv_eval_par
.int_size_1
) {
489 zero_off_tmp
= piv_eval_par
.zero_off
;
490 weight_tmp
= piv_eval_par
.weight
;
491 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
492 (eval
->checkbutton_weightkernel
), FALSE
);
493 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
494 (eval
->checkbutton_zerooff
), TRUE
);
495 gtk_widget_set_sensitive(eval
->checkbutton_zerooff
, FALSE
);
499 * Reset weight and zero_off
502 if (zero_off_tmp
== 0) {
503 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
504 (eval
->checkbutton_zerooff
), FALSE
);
505 if (weight_tmp
== 0) {
506 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
507 (eval
->checkbutton_weightkernel
), FALSE
);
509 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
510 (eval
->checkbutton_weightkernel
), TRUE
);
513 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
514 (eval
->checkbutton_zerooff
), TRUE
);
516 gtk_widget_set_sensitive(eval
->checkbutton_zerooff
, TRUE
);
520 } else if (var_type
== SHIFT
) {
521 piv_eval_par
.int_shift
= atoi(gtk_object_get_data(GTK_OBJECT(widget
),
526 gtk_spin_button_set_value(GTK_SPIN_BUTTON
527 (eval
->spinbutton_intshift
),
528 piv_eval_par
.int_shift
);
531 if (disp
!= NULL
&& disp
->display_intregs
== 1) {
532 destroy_all_intregs(display_act
);
533 create_all_intregs(display_act
);
542 on_toggle_piv(GtkWidget
* widget
,
545 PivEval
* eval
= gtk_object_get_data(GTK_OBJECT(widget
), "eval");
556 * Select which variable has to be modified
558 var_type
= atoi(gtk_object_get_data(GTK_OBJECT(widget
), "var_type"));
560 if (var_type
== SCHEME
) {
561 piv_eval_par
.ifit
= atoi(gtk_object_get_data(GTK_OBJECT(widget
),
564 } else if (var_type
== PEAK_NR
) {
565 piv_eval_par
.peak
= atoi(gtk_object_get_data(GTK_OBJECT(widget
),
569 } else if (var_type
== WEIGHT
) {
570 if (GTK_TOGGLE_BUTTON(widget
)->active
) {
571 piv_eval_par
.weight
= 1;
572 gtk_widget_set_sensitive(eval
->checkbutton_zerooff
, FALSE
);
573 gtk_widget_set_sensitive(eval
->checkbutton_centraldiff
, FALSE
);
575 * toggle adaptive interr and zero-off
578 piv_eval_par
.weight
= 0;
579 gtk_widget_set_sensitive(eval
->checkbutton_zerooff
, TRUE
);
580 gtk_widget_set_sensitive(eval
->checkbutton_centraldiff
, TRUE
);
584 } else if (var_type
== ZERO_OFF
) {
585 if (GTK_TOGGLE_BUTTON(widget
)->active
) {
586 piv_eval_par
.zero_off
= 1;
587 gtk_widget_set_sensitive(eval
->checkbutton_weightkernel
, FALSE
);
589 piv_eval_par
.zero_off
= 0;
590 gtk_widget_set_sensitive(eval
->checkbutton_weightkernel
, TRUE
);
594 } else if (var_type
== CENTRAL_INT
) {
595 if (gtk_toggle_button_get_active
596 (GTK_TOGGLE_BUTTON(eval
->checkbutton_centraldiff
))) {
597 piv_eval_par
.central_diff
= 1;
599 piv_eval_par
.central_diff
= 0;
603 } else if (var_type
== CORRELATION
) {
604 image_par
.x_corr
= atoi(gtk_object_get_data(GTK_OBJECT(widget
),
613 adjust_radiobutton_piv_int(PivEval
* eval
,
617 * adjusting and disabling int_size_2 and its toggle buttons
621 /* if (int_size_1 == 8) { */
622 /* gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON */
623 /* (eval->radiobutton_intsize2_1), TRUE); */
624 /* } else */if (int_size_1
== 16) {
625 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
626 (eval
->radiobutton_intsize2_2
), TRUE
);
627 } else if (int_size_1
== 32) {
628 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
629 (eval
->radiobutton_intsize2_3
), TRUE
);
630 } else if (int_size_1
== 64) {
631 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
632 (eval
->radiobutton_intsize2_4
), TRUE
);
633 } else if (int_size_1
>= 128) {
634 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
635 (eval
->radiobutton_intsize2_5
), TRUE
);
639 if (int_size_1
<= 64) {
640 gtk_widget_set_sensitive(GTK_WIDGET(eval
->radiobutton_intsize2_4
),
642 if (int_size_1
<= 32) {
643 gtk_widget_set_sensitive(GTK_WIDGET
644 (eval
->radiobutton_intsize2_3
),
646 if (int_size_1
<= 16) {
647 gtk_widget_set_sensitive(GTK_WIDGET
648 (eval
->radiobutton_intsize2_2
),
650 /* if (int_size_1 <= 8) { */
651 /* gtk_widget_set_sensitive(GTK_WIDGET */
652 /* (eval->radiobutton_intsize2_1), */
661 if (int_size_1
>= 16) {
662 /* gtk_widget_set_sensitive(GTK_WIDGET(eval->radiobutton_intsize2_1), */
664 if (int_size_1
>= 32) {
665 gtk_widget_set_sensitive(GTK_WIDGET
666 (eval
->radiobutton_intsize2_2
),
668 if (int_size_1
>= 64) {
669 gtk_widget_set_sensitive(GTK_WIDGET
670 (eval
->radiobutton_intsize2_3
),
672 if (int_size_1
>= 128) {
673 gtk_widget_set_sensitive(GTK_WIDGET
674 (eval
->radiobutton_intsize2_4
),
686 on_checkbutton_piv_disprocess_enter(GtkWidget
*widget
,
689 GpivConsole
* gpiv
= gtk_object_get_data(GTK_OBJECT(widget
), "gpiv");
691 _("Displays subimages, correlation image and cov. peak location");
692 gnome_appbar_set_status(GNOME_APPBAR(gpiv
->appbar
), msg
);
695 void on_checkbutton_piv_disprocess(GtkWidget
* widget
, gpointer data
)
697 PivEval
* eval
= gtk_object_get_data(GTK_OBJECT(widget
), "eval");
698 if (piv_eval_par
.print_cov
== 0) {
699 piv_eval_par
.print_cov
= 1;
700 gci_background_piv_disprocess
=
701 gnome_canvas_item_new(gnome_canvas_root
702 (GNOME_CANVAS(eval
->canvas_disprocess_dval
)),
703 gnome_canvas_rect_get_type(),
708 "fill_color", "darkblue",
712 piv_eval_par
.print_cov
= 0;
714 g_warning("checkbutton_piv_disprocess clicked, print_cov = %d",
715 piv_eval_par
.print_cov
);
721 * showing interrogation area's and correlation function
724 on_darea_piv_disprocess_int1_expose(GtkWidget
* widget
,
725 GdkEventExpose
* event
,
728 gdk_draw_gray_image(widget
->window
,
729 widget
->style
->fg_gc
[GTK_STATE_NORMAL
], 0, 0,
730 MAX_INTERR_SIZE
, MAX_INTERR_SIZE
, GDK_RGB_DITHER_MAX
,
731 graybuf_int1
, MAX_INTERR_SIZE
);
738 on_darea_piv_disprocess_int2_expose(GtkWidget
* widget
,
739 GdkEventExpose
* event
,
742 gdk_draw_gray_image(widget
->window
,
743 widget
->style
->fg_gc
[GTK_STATE_NORMAL
], 0, 0,
744 MAX_INTERR_SIZE
, MAX_INTERR_SIZE
, GDK_RGB_DITHER_MAX
,
745 graybuf_int2
, MAX_INTERR_SIZE
);
752 on_darea_piv_disprocess_cov_expose(GtkWidget
* widget
,
753 GdkEventExpose
* event
,
756 gdk_draw_gray_image(widget
->window
,
757 widget
->style
->fg_gc
[GTK_STATE_NORMAL
], 0, 0,
758 MAX_INTERR_SIZE
, MAX_INTERR_SIZE
, GDK_RGB_DITHER_MAX
,
759 graybuf_cov
, MAX_INTERR_SIZE
);
767 on_button_piv_enter(GtkWidget
*widget
,
770 GpivConsole
* gpiv
= gtk_object_get_data(GTK_OBJECT(widget
), "gpiv");
771 gchar
*msg
= _("Analyses a PIV image (pair)");
772 gnome_appbar_set_status(GNOME_APPBAR(gpiv
->appbar
), msg
);
777 on_button_piv(GtkWidget
* widget
,
779 /* -------------------------------------------------------------------
780 The actual calculation of particle image displacements */
782 GpivConsole
* gpiv
= gtk_object_get_data(GTK_OBJECT(widget
), "gpiv");
786 for (row
= gpiv
->first_selected_row
; row
<= gpiv
->last_selected_row
;
788 display_act
= gtk_clist_get_row_data(GTK_CLIST(gpiv
->clist_buf
),
790 ibuf
= display_act
->count
;
791 if (display
[ibuf
] != NULL
792 && display_act
->mwin
!= NULL
793 && GTK_WIDGET_VISIBLE(GTK_WIDGET(display_act
->mwin
)) ) {
794 gdk_window_show(GTK_WIDGET(display_act
->mwin
)->window
);
795 gdk_window_raise(GTK_WIDGET(display_act
->mwin
)->window
);
806 exec_piv(GpivConsole
* gpiv
)
808 char c_line
[MAX_LINES_C
][MAX_CHARS
];
809 int nc_lines
= 0, return_val
= 0;
810 char fname_piv
[MAX_CHARS
], fname_old_piv
[MAX_CHARS
], sdum
[MAX_CHARS
];
812 * Free memory of pivdata and clean the display from its vectors
814 if (display_act
->gpd
.exist_piv
) {
815 destroy_all_vectors(&display_act
->gpd
);
816 gpiv_free_pivdata (&display_act
->gpd
.piv_data
);
817 display_act
->gpd
.exist_piv
= FALSE
;
818 if (display_act
->gpd
.scaled_piv
) {
819 gpiv_free_pivdata(&display_act
->gpd
.piv_data_scaled
);
820 display_act
->gpd
.scaled_piv
= FALSE
;
825 * Free eventually existing memory of vor_data and clean the display
826 * as they does not belong to the piv data anymore
828 free_post_bufmems(display_act
);
830 if (display_act
->img
.exist_img
&& !cancel_process
) {
834 * Reads old PIV data filemame.EXT_OLD for refined calculation
836 /* TODO??: NOT IMPLEMENTED IN GUI */
837 if (piv_eval_par
.old_piv
== 1) {
838 if (!display_act
->gpd
.exist_piv
) {
839 g_snprintf(fname_old_piv
, MAX_CHARS
, "%s%s", display_act
->fname_base
, EXT_OLD
);
840 g_snprintf(fname_piv
, MAX_CHARS
, "%s%s", display_act
->fname_base
, EXT_PIV
);
841 g_snprintf(sdum
, MAX_CHARS
, "mv %s %s", fname_piv
, fname_old_piv
);
843 if ((return_val
= gpiv_fcount_pivdata(fname_old_piv
, &display_act
->gpd
.piv_data
))
845 gpiv_error(_("Failure calling gpiv_count_pivdata for %s"),
850 gpiv_piv_count_pivdata_fromimage(&display_act
->gpd
.piv_data
,
851 image_par
, piv_eval_par
);
855 * Set mouse selection to None
857 if (m_select
== SINGLE_POINT_MS
858 || m_select
== SINGLE_AREA_MS
859 || m_select
== DRAG_MS
) {
860 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
861 (gpiv
->piveval
->radiobutton_mouse_1
),
866 * Allocating memory for output data, now the number of points are
867 * known (from old piv data or from the area of interest within the image
868 * and interrogation area sizes)
871 /* if (m_select != SINGLE_AREA_MS || */
872 /* (m_select == SINGLE_AREA_MS && ) { */
874 gpiv_alloc_pivdata(&display_act
->gpd
.piv_data
);
875 display_act
->gpd
.exist_piv
= TRUE
;
878 if (piv_eval_par
.old_piv
== 1) {
880 gpiv_fread_pivdata(fname_old_piv
, &display_act
->gpd
.piv_data
, c_line
,
882 gpiv_error(_("Failure calling gpiv_fread_pivdata for %s"),
887 /* printf ("\n%s: returned from gpiv_fread_pivdata\n", function_name); */
888 /* gpiv_write_pivdata(oldpiv_data, c_line, 0, 0, RCSID); */
891 * Determine locations of Interrogation Area's
893 if (piv_eval_par
.old_piv
!= 1 &&
894 m_select
!= SINGLE_AREA_MS
&&
895 m_select
!= SINGLE_POINT_MS
&&
896 m_select
!= DRAG_MS
) {
897 gpiv_piv_select_int_point(&display_act
->gpd
.piv_data
, image_par
,
900 /* fprintf (stderr, "%s:: returned from gpiv_piv_select_int_point\n", function_name); */
901 /* fprintf (stderr, "%s:: display_act->gpd.point_x = %f display_act->gpd.point_y = %f\n", */
902 /* function_name, display_act->gpd.piv_data.point_x[0][0], */
903 /* display_act->gpd.piv_data.point_y[0][0]); */
907 interrogate(&display_act
->gpd
.piv_data
, display_act
->img
.img1
,
908 display_act
->img
.img2
, gpiv
);
914 * Copy parameters in Buffer structure for saving and, eventual, later use
917 copy_img_par(image_par
, &display_act
->img
.image_par
, TRUE
, print_par
);
918 copy_piv_par(piv_eval_par
, &display_act
->gpd
.piv_eval_par
, TRUE
,
920 exec_process
= FALSE
;
924 _("At first, open an image. "
925 "Than we'll further see what will happen.");
926 g_warning(msg_error
);
927 gtk_warning(msg_error
);
935 interrogate(PivData
* piv_data
,
936 unsigned char **img1
,
937 unsigned char **img2
,
939 /* --------------------------------------------------------------------
940 PIV analyses of an image pair */
942 /* #define EXT_PIV ".piv" */
944 int index_x
= 0, index_y
= 0, int_size_0
, fname_logic
= 1;
945 gfloat progres_value
;
946 gchar progres_string
[MAX_CHARS
];
948 unsigned char **img1_ACT
= NULL
, **img2_ACT
= NULL
;
949 ImagePar image_par_ACT
;
950 PivEvalPar piv_eval_par_ACT
;
951 PivData piv_data_ACT
/* = *piv_data */;
953 /* Covariance *cov = display_act->gpd.cov; */
954 int sweep
= 1, sweep_last
= 0, exit_while
= 0,
956 char *fftwis
, *fftwis_inv
;
960 * Testing parameters on consistency and initializing derived
961 * parameters/variables
963 gpiv_piv_test_parameter(&image_par
, &piv_eval_par
, fname_logic
);
964 copy_img_par(image_par
, &image_par_ACT
, TRUE
, print_par
);
965 copy_piv_par(piv_eval_par
, &piv_eval_par_ACT
, TRUE
, print_par
);
967 if (piv_eval_par_ACT
.ad_int
== 1) {
968 piv_eval_par_ACT
.int_size_1
= piv_eval_par
.int_size_2
;
970 piv_eval_par_ACT
.int_size_1
= piv_eval_par
.int_size_1
;
975 if (piv_eval_par
.zero_off
|| piv_eval_par
.ad_int
) {
977 /* piv_eval_par_ACT.ifit = 0; */
980 /* piv_eval_par_ACT.ifit = piv_eval_par.ifit; */
985 * Reads eventually existing fftw wisdom
987 fftwis
= gpiv_fread_fftw_wisdom(1);
988 fftwis_inv
= gpiv_fread_fftw_wisdom(-1);
992 * Scanning int. area(s)
994 while ((!cancel_process
995 && piv_eval_par
.zero_off
!= 1 && sweep
<= 1)
996 || (piv_eval_par
.zero_off
== 1 && piv_eval_par_ACT
.ad_int
!= 1 &&
998 || (piv_eval_par_ACT
.ad_int
== 1 && exit_while
== 0 )) {
999 /* (piv_eval_par_ACT.ad_int == 1 && */
1000 /* piv_eval_par_ACT.int_size_2*cmpr_fact >= */
1001 /* piv_eval_par.int_size_1)) { */
1004 /* gpiv_img_print_header("", image_par_ACT); */
1005 /* gpiv_piv_print_parameters("EVAL.", piv_eval_par_ACT); */
1006 int_size_0
= ZEROPAD_FACT
* piv_eval_par_ACT
.int_size_2
;
1009 if (m_select
!= SINGLE_AREA_MS
&& m_select
!= DRAG_MS
) {
1010 destroy_all_vectors(&display_act
->gpd
);
1011 gnome_canvas_update_now(GNOME_CANVAS(display_act
->canvas
));
1016 * cleans drawing areas for displaying interrogation areas
1018 /* if (print_cov == 1) { */
1019 /* memset(graybuf_int1, 215, */
1020 /* (sizeof(guchar)) * (MAX_INTERR_SIZE * MAX_INTERR_SIZE)); */
1021 /* memset(graybuf_int2, 215, */
1022 /* (sizeof(guchar)) * (MAX_INTERR_SIZE * MAX_INTERR_SIZE)); */
1023 /* memset(graybuf_cov, 215, */
1024 /* (sizeof(guchar)) * (MAX_INTERR_SIZE * MAX_INTERR_SIZE)); */
1030 * Analyze at a single point
1032 if (piv_eval_par_ACT
.int_geo
== POINT
1033 || m_select
== SINGLE_AREA_MS
1034 || m_select
== SINGLE_POINT_MS
1035 || m_select
== DRAG_MS
) {
1037 img1_ACT
= &img1
[0];
1038 img2_ACT
= &img2
[0];
1039 piv_data_ACT
= *piv_data
;
1043 * Weight kernel for single int.area
1045 gpiv_piv_bounds_cov(&w_k
, int_size_0
, image_par_ACT
);
1046 w_k
.z
= gpiv_matrix(w_k
.z_rl
, w_k
.z_rh
, w_k
.z_cl
, w_k
.z_ch
);
1047 if (piv_eval_par
.weight
== 1) {
1048 gpiv_piv_weight_kernel_lin(&w_k
, int_size_0
);
1050 gpiv_piv_weight_kernel_1(&w_k
);
1053 alloc_bufmem_per_intarea(m_select_index_y
, m_select_index_x
,
1054 &display_act
->gpd
, image_par_ACT
,
1059 * Piv evaluation of ** A SINGLE** interrogation area
1061 gpiv_piv_eval_int_reg(m_select_index_y
,
1065 display_act
->gpd
.intreg1
[m_select_index_y
][m_select_index_x
],
1066 display_act
->gpd
.intreg2
[m_select_index_y
][m_select_index_x
],
1067 &display_act
->gpd
.cov
[m_select_index_y
][m_select_index_x
],
1079 * display piv values, draw interrogation areas and covariance function
1080 * WATCH OUT WITH CMPR!!
1082 if (piv_eval_par
.print_cov
== 1) {
1083 display_piv_vector(m_select_index_y
, m_select_index_x
,
1084 display_act
->gpd
.piv_data
,
1086 display_img_intreg1(display_act
->gpd
.intreg1
[m_select_index_y
]
1088 piv_eval_par_ACT
.int_size_2
,
1090 display_img_intreg2(display_act
->gpd
.intreg2
[m_select_index_y
]
1092 piv_eval_par_ACT
.int_size_2
,
1094 display_img_cov(&display_act
->gpd
.cov
[m_select_index_y
]
1096 piv_eval_par_ACT
.int_size_2
,
1100 free_bufmem_per_intarea(m_select_index_y
, m_select_index_x
,
1101 &display_act
->gpd
, image_par_ACT
, int_size_0
);
1105 * Anlyze all points wthin Area Of Interest
1110 * Speedup the process
1114 * Free memory of pivdata and clean the display from its vectors
1117 /* if (display_act->gpd.exist_display_act->gpd.intregs) { */
1118 /* destroy_all_intregs1(&display_act->gpd); */
1119 /* destroy_all_intregs2(&display_act->gpd); */
1120 /* free_intregs(&display_act->gpd.intregs); */
1121 /* display_act->gpd.exist_intregs = FALSE; */
1122 /* display_act->display_intregs = 0; */
1125 * SPEEDUP PROCEDURES
1127 /* if (piv_eval_par.zero_off) { */
1128 /* if (piv_eval_par.int_shift < piv_eval_par.int_size_2) { */
1129 /* speedup_ishi(&image_par_ACT,
1130 piv_eval_par_ACT, &piv_eval_par_ACT, */
1131 /* piv_data, &piv_data_ACT, sweep, sweep_last); */
1134 /* Enable/disable in combination with speedup_ishi */
1135 /* piv_data_ACT = *piv_data; */
1138 /* speedup_cmpr(img1, &img1_ACT, img2, &img2_ACT, image_par, */
1139 /* &image_par_ACT, piv_eval_par, &piv_eval_par_ACT, */
1140 /* &piv_data_ACT, &cmpr_fact, &int_size_0, sweep, sweep_last); */
1142 /* Enable when switched off speedup_cmpr: */
1143 /* img1_ACT = &img1[0]; */
1144 /* img2_ACT = &img2[0]; */
1147 img1_ACT
= &img1
[0];
1148 img2_ACT
= &img2
[0];
1149 piv_data_ACT
= *piv_data
;
1154 * SPEEDUP PROCEDURES END
1157 /* gpiv_piv_count_pivdata_fromimage(&display_act->gpd.intregs, */
1158 /* image_par_ACT, */
1159 /* piv_eval_par_ACT); */
1160 /* g_warning("intregs.nx=%d intregs.ny=%d\n", */
1161 /* display_act->gpd.intregs.nx, display_act->gpd.intregs.ny); */
1162 /* gpiv_alloc_scdata(&display[ibuf].intregs); */
1163 /* display_act->gpd.exist_intregs = TRUE; */
1164 /* gpiv_piv_select_int_point(&display_act->gpd.intregs, image_par_ACT, */
1165 /* piv_eval_par_ACT); */
1166 /* create_all_intregs1(&display_act->gpd); */
1167 /* create_all_intregs2(&display_act->gpd); */
1170 gpiv_piv_bounds_cov(&w_k
, int_size_0
, image_par_ACT
); /* piv_eval_par_ACT.int_size_2 ?? */
1171 w_k
.z
= gpiv_matrix(w_k
.z_rl
, w_k
.z_rh
, w_k
.z_cl
, w_k
.z_ch
);
1173 if (piv_eval_par
.weight
== 1) {
1174 gpiv_piv_weight_kernel_lin(&w_k
, int_size_0
);
1176 gpiv_piv_weight_kernel_1(&w_k
);
1183 /* if (piv_eval_par.zero_off && sweep_last == 1) { */
1184 /* gpiv_img_print_header(image_par_ACT); */
1185 /* gpiv_piv_print_parameters(piv_eval_par_ACT); */
1188 for (index_y
= 0; index_y
< piv_data_ACT
.ny
; index_y
++) {
1189 for (index_x
= 0; index_x
< piv_data_ACT
.nx
; index_x
++) {
1190 if (cancel_process
) break;
1191 alloc_bufmem_per_intarea(index_y
, index_x
, &display_act
->gpd
,
1192 image_par_ACT
, int_size_0
);
1197 * Printing the progress of processing
1200 100 * (index_y
* piv_data
->nx
+ index_x
+
1201 1) / (piv_data
->nx
* piv_data
->ny
);
1202 if (piv_eval_par
.zero_off
&& piv_eval_par
.ad_int
) {
1203 g_snprintf(progres_string
, MAX_CHARS
,
1205 "(int. size = %d): "
1208 piv_eval_par_ACT
.int_size_2
,
1209 (gint
) progres_value
);
1210 } else if (piv_eval_par
.zero_off
&& piv_eval_par
.ad_int
== 0) {
1211 g_snprintf(progres_string
, MAX_CHARS
,
1215 (gint
) progres_value
);
1217 g_snprintf(progres_string
, MAX_CHARS
,
1219 (gint
) progres_value
);
1222 while (g_main_iteration(FALSE
));
1223 gtk_progress_set_value(gnome_appbar_get_progress
1224 (GNOME_APPBAR(gpiv
->appbar
)),
1226 gnome_appbar_push(GNOME_APPBAR(gpiv
->appbar
),
1231 * Evaluates an interrogation area.
1232 * In the call int_size_1 might be defined equal to
1233 * piv_eval_par_ACT.int_size_2 as well;
1234 * this will reduce the snr during integration
1237 gpiv_piv_eval_int_reg(index_y
,
1241 display_act
->gpd
.intreg1
[index_y
][index_x
],
1242 display_act
->gpd
.intreg2
[index_y
][index_x
],
1243 &display_act
->gpd
.cov
[index_y
][index_x
],
1255 * Check on validity of data
1257 if (isnan(/* (double) */ display_act
->gpd
.piv_data
.dx
[index_y
][index_x
]) != 0
1258 || isnan(/* (double) */ display_act
->gpd
.piv_data
.dy
[index_y
][index_x
]) != 0) {
1259 display_act
->gpd
.piv_data
.dx
[index_y
][index_x
] = 0.0;
1260 display_act
->gpd
.piv_data
.dy
[index_y
][index_x
] = 0.0;
1261 display_act
->gpd
.piv_data
.snr
[index_y
][index_x
] = 99.9;
1262 display_act
->gpd
.piv_data
.peak_no
[index_y
][index_x
] = -1;
1267 /* printf("sweep =%d x=%f y=%f\n", sweep, */
1268 /* piv_data_ACT.point_x[index_y][index_x], */
1269 /* piv_data_ACT.point_y[index_y][index_x]); */
1272 * Only draw the vectors for last sweep
1276 /* while (!(my_in=getchar())) sleep(10); */
1277 /* fprintf(stderr, "interrogate:: i=%d j=%d x=%f y=%f dx=%f dy=%f\n", */
1278 /* index_y, index_x, */
1279 /* piv_data_ACT.point_x[index_y][index_x], */
1280 /* piv_data_ACT.point_y[index_y][index_x], */
1281 /* piv_data_ACT.dx[index_y][index_x], */
1282 /* piv_data_ACT.dy[index_y][index_x]); */
1284 /* if ( buf->gci_vector[index_y][index_x] == NULL) { */
1286 display_vector(index_y
, index_x
, &display_act
->gpd
);
1290 /* update_vector(index_y, index_x, &display_act->gpd); */
1293 /* if (display_act->gpd.exist_intregs) { */
1294 /* update_intreg2(index_y, index_x, &display_act->gpd); */
1295 /* update_intreg1(index_y, index_x, &display_act->gpd); */
1301 * Draw interrogation areas, covariance function, display piv vector
1302 * WATCH OUT WITH CMPR!!
1304 if (piv_eval_par
.print_cov
== 1) {
1305 display_piv_vector(index_y
,
1307 display_act
->gpd
.piv_data
,
1309 display_img_intreg1(display_act
->gpd
.intreg1
[index_y
][index_x
],
1310 piv_eval_par_ACT
.int_size_2
,
1312 display_img_intreg2(display_act
->gpd
.intreg2
[index_y
][index_x
],
1313 piv_eval_par_ACT
.int_size_2
,
1315 display_img_cov(&display_act
->gpd
.cov
[index_y
][index_x
],
1316 piv_eval_par_ACT
.int_size_2
,
1322 * Freeing memory; **Disable** to keep data with print_cov for viewing later
1324 /* => to exec_piv */
1327 free_bufmem_per_intarea(index_y
, index_x
,
1329 image_par_ACT
, int_size_0
);
1332 /* fprintf(stderr, "\n::i=%d j=%d zero_off=%d ad_int=%d int_size_1=%d" */
1333 /* "piv_eval_par_ACT.int_size_2=%d int_size_0=%d sweep=%d\n", */
1334 /* index_y, index_x, piv_eval_par.zero_off, */
1335 /* piv_eval_par.ad_int, piv_eval_par_ACT.int_size_1, */
1336 /* piv_eval_par_ACT.int_size_2, int_size_0, sweep); */
1345 * Once allocated for entire image: should be freed for new int area size
1347 gpiv_free_matrix(w_k
.z
, w_k
.z_rl
, w_k
.z_rh
, w_k
.z_cl
, w_k
.z_ch
);
1351 * Adjust piv_eval_par_ACT.int_size_2 in case int_size_1 is not a power of two
1354 if (piv_eval_par_ACT
.ad_int
== 1) {
1355 /* fprintf(stderr, "\n::int_size_1=%d int_size_1_ACT=%d" */
1356 /* "piv_eval_par.int_size_2_ACT=%d cmpr_fact=%d", */
1357 /* piv_eval_par.int_size_1, piv_eval_par_ACT.int_size_1, */
1358 /* piv_eval_par_ACT.int_size_2, cmpr_fact); */
1359 if (sweep_last
== 1) exit_while
= 1;
1360 if (piv_eval_par_ACT
.int_size_2
*cmpr_fact
/2 == piv_eval_par
.int_size_1
||
1361 piv_eval_par_ACT
.int_size_2
*cmpr_fact
/4 < piv_eval_par
.int_size_1
) {
1362 piv_eval_par_ACT
.int_size_1
= piv_eval_par
.int_size_1
/ cmpr_fact
;
1363 piv_eval_par_ACT
.int_size_2
= piv_eval_par
.int_size_1
/ cmpr_fact
;
1366 piv_eval_par_ACT
.int_size_1
= piv_eval_par_ACT
.int_size_2
/ 2;
1367 piv_eval_par_ACT
.int_size_2
= piv_eval_par_ACT
.int_size_2
/ 2;
1371 if (piv_eval_par
.zero_off
== 1 && piv_eval_par_ACT
.ad_int
!= 1) {
1376 if (sweep
== MAX_SWEEP
) {
1378 piv_eval_par_ACT
.ifit
= piv_eval_par
.ifit
;
1380 fprintf(stderr
, "\n");
1381 fprintf(stderr
, "\n");
1388 * Writes existing fftw wisdom
1390 gpiv_fwrite_fftw_wisdom(1, fftwis
);
1391 gpiv_fwrite_fftw_wisdom(-1, fftwis_inv
);
1394 display_act
->gpd
.scaled_piv
= FALSE
;
1395 display_act
->gpd
.saved_piv
= FALSE
;
1396 /* display_act->display_piv = TRUE; */
1398 /* gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(viewmenu_uiinfo[5].widget), TRUE); */
1400 display_act
->gpd
.exist_cov
= TRUE
;
1402 /* gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(viewmenu_uiinfo[6].widget), TRUE); */
1410 * Display functions in PIV tabulator canvas
1415 display_piv_vector(gint i
,
1419 /* ------------------------- Displays values in PIV tabulator of the GUI */
1421 float **dx
= piv_data
.dx
, **dy
= piv_data
.dy
;
1422 int **peak_no
= piv_data
.peak_no
;
1423 GnomeCanvasPoints
*points
;
1425 points
= gnome_canvas_points_new(2);
1427 if (peak_no
[i
][j
] == -1) {
1429 } else if (peak_no
[i
][j
] == 0) {
1431 } else if (peak_no
[i
][j
] == 1) {
1433 } else if (peak_no
[i
][j
] == 2) {
1436 /* if (peak_no[i][j] == 3) */
1440 /* fprintf(stderr, "\nDISPLAY_VECTOR:: 1"); */
1441 points
->coords
[0] = MAX_INTERR_SIZE
/ 2;
1442 points
->coords
[1] = MAX_INTERR_SIZE
/ 2;
1443 points
->coords
[2] = MAX_INTERR_SIZE
/ 2 + dx
[i
][j
] * gpiv_par
.vector_scale
;
1444 points
->coords
[3] = MAX_INTERR_SIZE
/ 2 + dy
[i
][j
] * gpiv_par
.vector_scale
;
1447 if (gci_vector_piv_disprocess
!= NULL
) {
1448 gnome_canvas_item_set(gci_vector_piv_disprocess
,
1450 "fill_color", color
,
1451 "width_units", (double) THICKNESS
,
1452 "first_arrowhead", FALSE
,
1453 "last_arrowhead", TRUE
,
1454 "arrow_shape_a", (double) ARROW_LENGTH
,
1455 "arrow_shape_b", (double) ARROW_EDGE
,
1456 "arrow_shape_c", (double) ARROW_WIDTH
,
1459 gci_vector_piv_disprocess
=
1460 gnome_canvas_item_new(gnome_canvas_root
1461 (GNOME_CANVAS(eval
->canvas_disprocess_dval
)),
1462 gnome_canvas_line_get_type(),
1464 "fill_color", "red",
1465 "width_units",(double) THICKNESS
,
1466 "first_arrowhead", TRUE
,
1467 "arrow_shape_a", (double) THICKNESS
,
1472 gnome_canvas_points_free(points
);
1478 display_img_intreg1(float **intreg1
,
1481 /* ------------------------- Displays image of intreg1 for drawing area */
1488 * As the mean has been substracted from the data, values have to be
1491 for (i
= 0; i
< int_size
; i
++) {
1492 for (j
= 0; j
< int_size
; j
++) {
1493 if (intreg1
[i
][j
] < min
)
1494 min
= intreg1
[i
][j
];
1499 pos
+= (MAX_INTERR_SIZE
- int_size
) / 2 * (MAX_INTERR_SIZE
+ 1);
1500 for (i
= 0; i
< int_size
; i
++) {
1501 for (j
= 0; j
< int_size
; j
++) {
1502 *pos
++ = (unsigned char) intreg1
[i
][j
] - (unsigned char) min
;
1504 pos
= pos
+ (MAX_INTERR_SIZE
- int_size
);
1506 gtk_widget_draw(GTK_WIDGET(eval
->darea_disprocess_int1
), pos
);
1511 void display_img_intreg2(float **intreg2
,
1514 /* ------------------------- Displays image of intreg1 for drawing area */
1521 * As the mean has been substracted from the data, values have to be tilted
1524 for (i
= 0; i
< int_size
; i
++) {
1525 for (j
= 0; j
< int_size
; j
++) {
1526 if (intreg2
[i
][j
] < min
)
1527 min
= intreg2
[i
][j
];
1533 pos
+= (MAX_INTERR_SIZE
- int_size
) / 2 * (MAX_INTERR_SIZE
+ 1);
1534 for (i
= 0; i
< int_size
; i
++) {
1535 for (j
= 0; j
< int_size
; j
++) {
1536 *pos
++ = (unsigned char) intreg2
[i
][j
] - (unsigned char) min
;
1538 pos
+= (MAX_INTERR_SIZE
- int_size
);
1540 gtk_widget_draw(GTK_WIDGET(eval
->darea_disprocess_int2
), pos
);
1544 void display_img_cov(Covariance
* cov
,
1547 /* ------------------------- Displays image of intreg1 for drawing area */
1551 float min
= 1000., max
= -1000.;
1553 int z_rl
= cov
->z_rl
, z_rh
= cov
->z_rh
, z_cl
= cov
->z_cl
, z_ch
=
1560 for (i
= z_rl
; i
< z_rh
; i
++) {
1561 for (j
= z_cl
; j
< z_ch
; j
++) {
1562 if (cov
->z
[i
][j
] < min
)
1564 if (cov
->z
[i
][j
] > max
)
1571 pos
+= (MAX_INTERR_SIZE
- int_size
) / 2 * (MAX_INTERR_SIZE
+ 1);
1572 /* pos += (MAX_INTERR_SIZE - int_size/2)/2 * (MAX_INTERR_SIZE+1); */
1574 /* pos += (MAX_INTERR_SIZE - 3*int_size/4)/2; */
1577 for (i
= z_rl
; i
< z_rh
; i
++) {
1578 for (j
= z_cl
; j
< z_ch
; j
++) {
1579 cov
->z
[i
][j
] -= min
;
1580 cov
->z
[i
][j
] = (255.0 / (max
- min
)) * cov
->z
[i
][j
];
1581 *pos
++ = (unsigned char) cov
->z
[i
][j
];
1583 pos
+= (MAX_INTERR_SIZE
- int_size
) + 1;
1586 gtk_widget_draw(GTK_WIDGET(eval
->darea_disprocess_cov
), pos
);