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

Linux Cross Reference
Tina6/tina-tools/tinatool/tlbase/tlbaseSeq_tool.c

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

  1 /**********
  2  * 
  3  * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
  4  * University of Manchester, UK.  All rights reserved.
  5  * 
  6  * Redistribution and use in source and binary forms, with or without modification,
  7  * are permitted provided that the following conditions are met:
  8  *
  9  *   . Redistributions of source code must retain the above copyright notice, 
 10  *     this list of conditions and the following disclaimer.
 11  *    
 12  *   . Redistributions in binary form must reproduce the above copyright notice,
 13  *     this list of conditions and the following disclaimer in the documentation 
 14  *     and/or other materials provided with the distribution.
 15  * 
 16  *   . Neither the name of the University of Manchester nor the names of its
 17  *     contributors may be used to endorse or promote products derived from this 
 18  *     software without specific prior written permission.
 19  * 
 20  * 
 21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 31  * POSSIBILITY OF SUCH DAMAGE.
 32  *
 33  **********
 34  * 
 35  * Program :    TINA
 36  * File    :  $Source: /home/tina/cvs/tina-tools/tinatool/tlbase/tlbaseSeq_tool.c,v $
 37  * Date    :  $Date: 2009/05/15 15:51:20 $
 38  * Version :  $Revision: 1.15 $
 39  * CVS Id  :  $Id: tlbaseSeq_tool.c,v 1.15 2009/05/15 15:51:20 paul Exp $
 40  *
 41  * Notes : Sequence Tool. What more is there to say?
 42  *         The purpose of this new incarnation of the sequence tool is
 43  *         twofold:
 44  *         1) To be able to do all the sequence tool stuff which could be
 45  *            be done before
 46  *         2) To have a proper sequence structure, so we can have multiple 
 47  *            instantiations of a sequence like you can have for imrects etc
 48  *********
 49 */
 50 
 51 #include "tlbaseSeq_tool.h"
 52 
 53 #if HAVE_CONFIG_H
 54 #   include <config.h>
 55 #endif
 56 
 57 #include <stdio.h>
 58 #include <string.h>
 59 #include <sys/param.h>
 60 #include <float.h>
 61 /* #include <sys/time.h> Used in the millisecond timing example in seq_load_proc */
 62 #include <tina/sys/sysDef.h>
 63 #include <tina/sys/sysPro.h>
 64 #include <tina/file/filePro.h>
 65 #include <tina/image/imgDef.h>
 66 #include <tina/image/imgPro.h>
 67 #include <tina/geometry/geomDef.h>
 68 #include <tina/geometry/geomPro.h>
 69 #include <tinatool/wdgts/wdgtsPro.h>
 70 #include <tinatool/tlbase/tlbasePro.h>
 71 #include <tina/file/fileThirdParty_air.h>
 72 #include <tinatool/draw/drawDef.h>
 73 #include <tinatool/draw/drawPro.h>
 74 #include <tinatool/tlbase/tlbase_SeqPro.h>
 75 #include <tinatool/tlbase/tlbase_SeqDef.h>
 76 #include <tinatool/tlbase/tlbaseSeq_disp.h>
 77 #include <tinatool/tlbase/tlbaseSeq_view.h>
 78 #include <tinatool/tlmedical/tlmedPro.h>
 79 
 80 static int offset = 0;
 81 static int stride = 1;
 82 static int downsample = 1;
 83 static int frame = 0;
 84 static char filename[MAXPATHLEN];
 85 static int end = 0;
 86 static int file_type = SEQTL_AIFF_FILE;
 87 static double xscale = 1.0, yscale = 1.0, zscale = 1.0, tscale = 1.0;
 88 
 89 static void *poffset = NULL, *pstride=NULL, *pfilename=NULL, *pend=NULL, *pdownsample=NULL;
 90 static void *pxs=NULL, *pys=NULL, *pzs=NULL, *ptmp=NULL;
 91 static void *pcurfr=NULL, *seq_image_choice=NULL;
 92 static List *seq_init_funcs_list=NULL;
 93 
 94 /*mjs 25/11/05 added scale factor flag variables and functions so user can choose which scale 
 95  factors to use when loading DICOM data*/
 96 static int seq_scale_factor_flag = 0;
 97 
 98 
 99 /* This flag determines whether to average across frames when the sequence is loaded with a
100 non-zero stride.  This may affect parts of the code that rely on any information from the 
101 DICOM header that varies between frames and is entered into the props list, since only the 
102 value from the first frame in each average will be used.  In addition, it is currently only 
103 implemented for DICOM images */
104 static int stride_av_flag=0;
105 
106 int get_seq_scale_factor_flag()
107 {
108   return(seq_scale_factor_flag);
109 }
110 
111 static void set_seq_scale_factor_flag(int flag)
112 {
113   seq_scale_factor_flag = flag;
114   return;
115 }
116 
117 
118 /* seq-init-funcs-list is a list of pointers to functions. These functions */
119 /* are invoked whenever seq-load is called, allowing tools higher in the   */
120 /* libraries (esp. the coreg tool) to update themselves whenever the       */
121 /* sequence changes, without having direct calls to them at this level of  */
122 /* the libraries. Calling seq_init_funcs_add will add a new function to    */
123 /* the list: the functions are actually invoked by seq_init_funcs_run. At  */
124 /* the moment, the functions have to have void arguments and return types. */
125 /*                                                                         */
126 /* paul.bromiley@manchester.ac.uk 29/11/2004                               */
127 
128 void seq_init_funcs_add(void (*function_to_add)())
129 {
130         List *el=NULL;
131 
132         /* warning: argument #1 is incompatible with prototype:
133         prototype: pointer to void : "/home/fx/tina-libs/tina/sys/sysLst_list.h", line 100
134         argument : pointer to function() returning void */
135         el = link_alloc(function_to_add, 5367);
136         seq_init_funcs_list = list_addtoend(seq_init_funcs_list, el);
137 }
138 
139 void seq_init_funcs_run(void)
140 {
141         void (*function_to_run)(void)=NULL;
142         List *plist=NULL;
143 
144         for(plist = seq_init_funcs_list; plist!=NULL; plist=plist->next)
145         {
146           /* warning: assignment type mismatch:
147         pointer to function(void) returning void "=" pointer to void */
148                 function_to_run = plist->to;
149                 function_to_run();
150         }
151 }
152 
153 
154 static int seq_file_type_find(void)
155 {
156         Sequence *seq = seq_get_current();
157         List *lptr = get_seq_current_el(seq);
158         Imrect *im=NULL;
159         int vtype, seq_im_type;
160 
161         if(lptr!=NULL)
162         {
163                 im = (Imrect *)lptr->to;
164                 if(im!=NULL)
165                 {
166                         vtype = im->vtype;
167                         if (vtype==uchar_v) seq_im_type = 1;
168                         if (vtype==char_v) seq_im_type = 1;
169                         if (vtype==short_v) seq_im_type = 2;
170                         if (vtype==ushort_v) seq_im_type = 2;
171                         if (vtype==int_v) seq_im_type = 2;
172                         if (vtype==uint_v) seq_im_type = 2;
173                         if (vtype==float_v) seq_im_type = 3;
174                 }
175         }
176         else seq_im_type = 0;
177         return seq_im_type;
178 }
179 
180 
181 static void seq_file_type_reset(void)
182 {
183         int val=seq_file_type_find();
184 
185         switch (val)
186         {
187                 case 1:
188                         tw_choice_reset(seq_image_choice, 1);
189                         break;
190                 case 2:
191                         tw_choice_reset(seq_image_choice, 2);
192                         break;
193                 case 3:
194                         tw_choice_reset(seq_image_choice, 3);
195                         break;
196                 default:
197                         tw_choice_reset(seq_image_choice, 0);
198         }
199 }
200 
201 
202 int    get_seq_filechoice(void)
203 {
204   return(file_type);
205 }
206 
207 
208 void seq_file_choice_proc(int val)
209 {
210     file_type = val;
211 }
212 
213 /* forces Sequence dimensions to be as on interface. For use when
214    loading in sequences of aiff images etc, where no dimensions are specified. */
215 
216 
217 static void seq_update_proc(void)
218 {
219   Sequence *seq = NULL;
220   int filename_length;
221 
222   if ((seq = seq_get_current()) == NULL)
223     return;
224 
225   seq->dim[0] = xscale;
226   seq->dim[1] = yscale;
227   seq->dim[2] = zscale;
228   seq->dim[3] = tscale;
229 
230   filename_length = strlen(filename);
231   seq->filename = cvector_copy(filename, 0, filename_length);
232 
233   seq->stride = stride; /* not sure you'd ever want to do this */
234   seq->downsample = downsample; /* or this either */
235   seq->offset = offset;
236 
237   return;
238 }
239 
240 /* seq_param_update updates the interface with the values in the
241    Sequence structure */
242 
243 
244 void seq_param_update(Sequence *seq)
245 {
246 
247   if (seq == NULL)
248     return;
249 
250   offset = seq->offset;
251   stride = seq->stride;
252   downsample = seq->downsample;
253   xscale = seq->dim[0];
254   yscale = seq->dim[1];
255   zscale = seq->dim[2];
256   tscale = seq->dim[3];
257 
258   end = get_end_frame(seq);
259 
260   (void) tw_sglobal_reset(pfilename);
261   (void) tw_iglobal_reset(poffset);
262   (void) tw_iglobal_reset(pstride);
263   (void) tw_iglobal_reset(pdownsample);
264   (void) tw_fglobal_reset(pxs);
265   (void) tw_fglobal_reset(pys);
266   (void) tw_fglobal_reset(pzs);
267   (void) tw_fglobal_reset(ptmp);
268 
269   (void) tw_iglobal_reset(pcurfr);
270   (void) tw_iglobal_reset(pend);
271   seq_file_type_reset();
272 }
273 
274 
275 static void inter_update_proc(void)
276 {
277   Sequence *seq = NULL;
278 
279   if ((seq = (Sequence *)seq_get_current()) == NULL)
280     return;
281 
282   seq_param_update(seq);
283 
284 }
285 
286 /* Number of last image in sequence only available from interface,
287    have functions to get and set the end number*/
288 
289 
290 int get_seq_end(void)
291 {
292   return(end);
293 }
294 
295 void set_seq_end(int new_end)
296 {
297   end = new_end;
298   if (pend != NULL)
299     tw_iglobal_reset(pend);
300 
301 }
302 
303 
304 static int seq_cast_proc(Sequence *seq, Vartype vtype, int bin_flag)
305 {
306     List *nptr=NULL, *mptr=NULL, *lptr = get_seq_current_el(seq);
307     Imrect *im=NULL, *im2=NULL, *im3=NULL;
308     int cast_flag=0;
309 
310     /* If the current element of the sequence is NULL then the user
311     has run off of the end of the sequence: do no casting */
312 
313     if(seq==NULL||lptr==NULL) return 0;
314     nptr=get_seq_start_el(seq);
315 
316     for(mptr=nptr; mptr!=NULL; mptr=mptr->next)
317     {
318         im = (Imrect *)mptr->to;
319         if(bin_flag==1)
320         {
321             im3 = im_bthresh(0.5, im);
322             im_free(im);
323             im=im3;
324         }
325 
326         if(bin_flag==1 || im->vtype!=vtype)
327         {
328             im2 = (Imrect *)im_cast(im, vtype);
329             mptr->to = im2;
330             im_free(im);
331             cast_flag=1;
332         }
333     }
334     return cast_flag;
335 }
336 
337 
338 void seq_type_choice_proc(int val)
339 {
340     /* Allows casting of whole image sequences, like the image casting choice
341     buttons in imcalc. There may be complications here if you produce sequences
342     containing images of different variable types PAB 25/12/2004*/
343 
344     Sequence *seq=seq_get_current();
345     int cast_flag;
346 
347     switch (val)
348     {
349     case 0:
350         cast_flag = seq_cast_proc(seq, uchar_v, 1);
351         tw_choice_reset(seq_image_choice, 0);
352         break;
353     case 1:
354         cast_flag = seq_cast_proc(seq, uchar_v, 0);
355         tw_choice_reset(seq_image_choice, 1);
356         break;
357     case 2:
358         cast_flag = seq_cast_proc(seq, short_v, 0);
359         tw_choice_reset(seq_image_choice, 2);
360         break;
361     case 3:
362         cast_flag = seq_cast_proc(seq, float_v, 0);
363         tw_choice_reset(seq_image_choice, 3);
364         break;
365     default:
366         tw_choice_reset(seq_image_choice, 0);
367         break;
368     }
369     tv_init(seq_tv_get());
370     seq_show_current(seq);
371     if(cast_flag==1) seq_init_funcs_run();
372 }
373 
374 
375 /* button call to save sequence. */
376 
377 
378 static void seq_save_proc(void)
379 {
380   Sequence * seq = seq_get_current();
381 
382   if (seq == NULL)
383     {
384       error(" no sequence to save \n", non_fatal);
385       return;
386     }
387   seq_save(seq, filename, &offset, &stride, NULL, NULL, file_type);
388   /*seq_save(seq, filename, NULL, NULL, NULL, NULL, file_type);*/
389   /* all these values will be null if called from this button
390      but user can insert own values when calling seq_save by self*/
391 }
392 
393 
394 /* Button call to load sequences. allows user to potentially load specified sequence */
395 
396 
397 static void seq_load_proc(void)
398 {
399   Sequence *seq = NULL;
400   int end_frame;
401 
402   /* Example of how to do millisecond timing */
403   /*
404   struct timeval tv1, tv2;
405   double time1, time2;
406 
407   gettimeofday(&tv1, NULL);
408  */
409 
410   if ((seq = seq_load(filename, offset, stride, downsample, end, file_type, stride_av_flag)) == NULL)
411   {
412     format("sequence is NULL");
413     return;
414   }
415 
416   /*
417   gettimeofday(&tv2, NULL);
418   time1 = ((double) tv1.tv_sec) + ((double) tv1.tv_usec)/1000000.0;
419   time2 = ((double) tv2.tv_sec) + ((double) tv2.tv_usec)/1000000.0;
420   format("Sequence load time=%5.3f (s) \n", time2-time1);
421   */
422 
423   seq_set_current(seq);
424 
425   end_frame = get_end_frame(seq);
426   set_seq_end(end_frame);
427   frame = seq->offset;
428 
429   tv_init(seq_tv_get());
430   seq_show_current(seq);
431   seq_param_update(seq);
432 
433   seq_init_funcs_run();
434 }
435 
436 
437 void seq_load_wrapper(char *ext_filename, int ext_offset, int ext_stride, int ext_end, int ext_file_type)
438 {
439         /* External loader for sequence tool paul.bromiley@manchester.ac.uk 30/11/2004*/
440 
441         strcpy(filename, ext_filename);
442         offset = ext_offset;
443         stride = ext_stride;
444         end = ext_end;
445         file_type = ext_file_type;
446 
447         /* Existing loader handles the rest... well done mjs! */
448 
449         seq_load_proc();
450 }
451 
452 
453 /* not sure if these should be static or not. */
454 /* jumps to and shows first image in the sequence */
455 
456 
457 static void show_first_proc(void)
458 {
459   Sequence *seq = seq_get_current();
460 
461   if (seq == NULL)
462     return;
463 
464   seq_update_proc();
465   frame = seq->offset;
466   tw_iglobal_reset(pcurfr);
467   seq->current = seq->start;
468 
469   seq_show_current(seq);
470   inter_update_proc();
471 }
472 
473 /*jumps to and shows last image in sequence */
474 
475 
476 static void show_end_proc(void)
477 {
478   Sequence *seq = seq_get_current();
479 
480   if (seq == NULL)
481     return;
482 
483   seq_update_proc();
484   frame = get_end_frame(seq);
485   set_seq_current_el(seq, get_seq_end_el(seq));
486   seq_show_current(seq);
487   inter_update_proc();
488 }
489 
490 /* moves through the sequence by one stride at a time.
491    function is used for both up and down directions, direction
492    moved in determined by the sign of the variable "incr" */
493 
494 
495 static void show_incr_proc(int incr)
496 {
497   Sequence *seq = seq_get_current();
498 
499   if (seq == NULL)
500     return;
501 
502   seq_update_proc();
503   frame = frame + (incr*seq->stride);
504   tw_iglobal_reset(pcurfr);
505 
506   set_seq_current_frame(seq, frame);
507 
508   seq_show_current(seq);
509   inter_update_proc();
510 }
511 
512 /* jumps to the image frame specified by the frame field on the tool */
513 
514 
515 static void jumpto_proc(void)
516 {
517 
518   Sequence *seq = (Sequence *)seq_get_current();
519 
520   if (seq == NULL)
521     return;
522 
523   seq_update_proc();
524   set_seq_current_frame(seq, frame);
525   seq_show_current(seq);
526   inter_update_proc();
527 }
528 
529 
530 /* removes one frame from the sequence */
531 /* wrote explanantion of this elsewhere????*/
532 
533 
534 static void delete_seq_frame_proc(void)
535 {
536   Sequence * data = seq_get_current();
537   Tv      *tv_ptr = seq_tv_get();
538 
539   if ((tv_ptr == NULL))
540     return;
541 
542   if (data == NULL)
543     return;
544 
545   seq_update_proc();
546   data = delete_seq_frame(data);
547   set_seq_end(get_end_frame(data));
548 
549   if (data != NULL)
550   {
551      seq_set_current(data);
552      frame = data->offset + get_seq_current_frame(data);
553      seq_param_update(data);
554   }
555 
556   tv_free_background(tv_ptr);
557   tv_repaint(tv_ptr);
558   inter_update_proc();
559   return;
560 }
561 
562 /*button wrapper to insert frame into sequence */
563 
564 
565 static void insert_seq_frame_proc(void)
566 {
567   Sequence * data = seq_get_current();
568   Imrect  *im = NULL;
569   Tv      *tv_ptr = seq_tv_get();
570   int      image_data = IMAGE_DATA;
571 
572   if (tv_ptr == NULL)
573     return;
574 
575   /*
576     if (data == NULL)
577      return;
578   */
579 
580   if (data == NULL)
581     {
582       if ((data = seq_alloc()) == NULL)
583         {
584           error("can't allocate sequence \n", non_fatal);
585           return;
586         }
587     }
588 
589   seq_update_proc();
590   if ((im = seq_pop_data(im, image_data)) == NULL)
591     return;
592 
593   seq_frame_insert(im, data);
594 
595   seq_show_current(data);
596   seq_show_bits();
597   set_seq_end(get_seq_end()+data->stride);
598   frame = frame+data->stride; /*check this works */
599   inter_update_proc();
600 }
601 
602 /* replaces a frame with imrect on imcalc stack*/
603 
604 
605 static void replace_seq_frame_proc(void)
606 {
607   Sequence * data = seq_get_current();
608   Imrect *im = NULL;
609   Imrect *im1 = NULL;
610   List *lptr = get_seq_current_el(data);
611   Tv     *tv_ptr = seq_tv_get();
612   int     image_data;
613 
614   image_data = IMAGE_DATA;
615 
616   if (data == NULL)
617     return;
618 
619   if (tv_ptr == NULL)
620     return;
621 
622   if((lptr == NULL) || (lptr->to == NULL))
623     {
624       error("unable to replace here ", warning);
625       return;
626     }
627 
628   if (frame < data->offset || frame > get_seq_end())
629     {
630       error("unable to replace here ", warning);
631       return;
632     }
633 
634 
635   seq_update_proc();
636   if ((im = seq_pop_data(im, image_data)) == NULL)
637     return;
638 
639   im1 = lptr->to;
640   lptr->to = im;
641   im_free(im1);
642   seq_image_set(im);
643   seq_show_bits();
644   seq_show_current(data);
645   inter_update_proc();
646   return;
647 
648 }
649 
650 /* button proc to push frame onto imcalc stack */
651 
652 
653 static void push_seq_frame_proc(void)
654 {
655 
656   Sequence *data = (Sequence *) seq_get_current();
657 
658   if (data == NULL)
659     return;
660 
661   if (frame < data->offset || frame > get_seq_end())
662     {
663       error("unable to push from here ", warning);
664       return;
665     }
666 
667   seq_update_proc();
668   seq_push_data(get_seq_current_el(data)->to);
669 
670   return;
671 
672 }
673 
674 void seq_str_rm_proc(void)
675 {
676 /* temporary proc to remove whole sequence */
677   Tv * seq_tv = seq_tv_get();
678   Sequence *seq = seq_get_current();
679 
680   seq_rm(seq);
681 
682   seq_image_set(NULL);
683   if (seq_tv == NULL)
684     return;
685   tv_erase(seq_tv);
686   tv_free_background(seq_tv);
687   tv_init(seq_tv);
688 
689 }
690 
691 static void stack_seq_proc(void)
692 {
693 /* moves a sequence of images on the stack into the sequence */
694   Sequence *seq = NULL;
695   Tv *seq_tv = seq_tv_get();
696 
697   seq_update_proc();
698   seq_str_rm_proc();
699   stack_seq(NULL);
700   if(seq_tv!=NULL)
701   {
702       tv_erase(seq_tv);
703       tv_free_background(seq_tv);
704       tv_init(seq_tv); /* don't need tv_free_background if use tv_init() */
705   }
706   if (imcalc_tv_get()!= NULL) tv_init(imcalc_tv_get());
707   if (imcal2_tv_get()!= NULL) tv_init(imcal2_tv_get());
708 
709   set_seq_end(get_end_frame(seq));
710   inter_update_proc();
711 }
712 
713 
714 static void copy_test_proc(void)
715 {
716   Sequence *seq = NULL;
717   Sequence *copy = NULL;
718 
719   if ((seq = seq_get_current()) == NULL)
720     return;
721 
722   copy = seq_copy(seq);
723   seq_rm(seq);
724   seq_set_current(copy);
725   seq_show_current(copy);
726 }
727 
728 void seq_scales_update(double nxscale, double nyscale, double nzscale)
729 {
730    xscale = nxscale;
731    yscale = nyscale;
732    zscale = nzscale;
733    (void) tw_fglobal_reset(pxs);
734    (void) tw_fglobal_reset(pys);
735    (void) tw_fglobal_reset(pzs);
736    format("Warning: remember to update the sequence scales before output \n");
737 }
738 
739 static void seq_scan_proc(void)
740 {
741    scan_files(filename, NULL);
742    clip_suffix(filename);
743    tw_sglobal_reset(pfilename);
744 }
745 
746 static void tv_choice_proc(int val)
747 {
748     switch (val)
749     {
750       case 0:
751       {
752         if (seq_tv_get()==NULL)
753         {
754           seq_tv_set(seq_tv_make());
755          }
756          tv_set_next(seq_tv());
757          seq_image_on(1);
758       }
759       break;
760     }
761 }
762 
763 
764 static void seq_stride_average_choice_proc(int val)
765 {
766     stride_av_flag = val;
767 }
768 
769 
770 void set_seq_sfile(struct air16 *air1)
771 {
772    char *newfilename = air1->s_file;
773 
774    strcpy(filename,newfilename);
775    tw_sglobal_reset(pfilename);
776 }
777 
778 void set_seq_rfile(struct air16 *air1, int num)
779 {
780    char *newfilename = air1->r_file;
781 
782    strcpy(filename,newfilename);
783    parse_fname(NULL,filename,num);
784    tw_sglobal_reset(pfilename);
785 }
786 
787 
788 void         seq_tool(int x, int y)
789 {
790   static void *tool = NULL;
791   int val;
792 
793   if (tool)
794   {
795       tw_show_tool(tool);
796       return;
797   }
798 
799   tool = tw_tool("Sequence Tool", x, y);
800 
801   tw_choice("Tv : ", tv_choice_proc, 0, "sequence", NULL);
802   tw_help_button("sequence_tool");
803   tw_newrow();
804 
805   tw_choice("File:    ", seq_file_choice_proc, 0,
806             "AIFF", "ANLZ", "RAD", "NEMA", "PGM", "DICOM", NULL);
807   tw_menubar("", "DICOM (re)scale?", 
808              "Rescale", set_seq_scale_factor_flag, 0,
809              "Scale", set_seq_scale_factor_flag, 1,
810              NULL, NULL);
811   tw_newrow();
812   val = seq_file_type_find();
813   seq_image_choice = tw_choice("Image type:  ",
814            seq_type_choice_proc,val,"bin","chr","int","flt", NULL);
815   tw_newrow();
816 
817   poffset = (void *)tw_iglobal("Start :", &offset, 3);
818   pstride = (void *)tw_iglobal("Stride:", &stride, 3);
819   pdownsample = (void *)tw_iglobal("Downsample:", &downsample, 3);
820   pcurfr = (void *)tw_iglobal("Cur. frame:", &frame, 3);
821   pend = (void *)tw_iglobal("  End :", &end, 3);
822   tw_newrow();
823   pfilename = (void *)tw_sglobal("Image File:", filename, 40);
824   tw_button("Scan", seq_scan_proc, NULL);
825   tw_newrow();
826   tw_label("Scales:");
827   pxs = (void *)tw_fglobal("x:", &xscale, 10);
828   pys = (void *)tw_fglobal("y:", &yscale, 10);
829   pzs = (void *)tw_fglobal("z:", &zscale, 10);
830   ptmp = (void *)tw_fglobal("t:", &tscale, 10);
831   tw_newrow();
832   tw_button("Load", seq_load_proc, NULL);
833   tw_button("Save", seq_save_proc, NULL);
834   tw_button("First", show_first_proc, NULL);
835   tw_button("<", show_incr_proc, (void *)-1);
836   tw_button(">", show_incr_proc, (void *)1);
837   tw_button("End", show_end_proc, NULL);
838   tw_button("Jumpto", jumpto_proc, NULL);
839   tw_choice("Stride average: ", seq_stride_average_choice_proc, 0, "Off", "On", NULL);
840   tw_newrow();
841   tw_button("Del Seq", seq_str_rm_proc, NULL);
842   tw_button("Del", delete_seq_frame_proc, NULL);
843   tw_button("Ins", insert_seq_frame_proc, NULL);
844   tw_button("Rep", replace_seq_frame_proc, NULL);
845   tw_button("Push", push_seq_frame_proc, NULL);
846   tw_button("Stack->Seq", stack_seq_proc, NULL);
847   tw_newrow();
848 /*
849   tw_label("Test Buttons:");
850   tw_newrow();
851   tw_button("Copy, delete and show", copy_test_proc, NULL);
852 */
853   tw_end_tool();
854 }
855 
856 
857 

~ [ 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.