Doxygen Source Code Documentation
afni_receive.c File Reference
#include "afni.h"Go to the source code of this file.
Define Documentation
|
|
Value: do{ if( nut == nall ){ \ nall += 128 ; \ xut = (int *) realloc( xut , sizeof(int) * nall ) ; \ yut = (int *) realloc( yut , sizeof(int) * nall ) ; \ zut = (int *) realloc( zut , sizeof(int) * nall ) ; \ } \ xut[nut] = xlast = (i) ; \ yut[nut] = ylast = (j) ; \ zut[nut] = zlast = (k) ; nut++ ; } while(0) |
|
|
|
Function Documentation
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 772 of file afni_receive.c. References abs, ENTRY, malloc, x2, y1, and z1. Referenced by AFNI_process_drawing().
00774 {
00775 int * xut , * yut , * zut ;
00776 int nut , iin , jout , nall ;
00777 int x1,y1,z1 , x2,y2,z2 , dx,dy,dz , adx,ady,adz , xlast,ylast,zlast ;
00778 float fdxyz , fdx,fdy,fdz , fx,fy,fz ;
00779
00780 ENTRY("AFNI_3d_linefill") ;
00781
00782 /* sanity check */
00783
00784 if( nin <= 0 || xin == NULL || yin == NULL || zin == NULL ){
00785 *nout = 0 ; *xout = *yout = *zout = NULL ; EXRETURN ;
00786 }
00787
00788 /* trivial case */
00789
00790 if( nin == 1 ){
00791 nut = 1 ; *nout = nut ;
00792 xut = (int *) malloc(sizeof(int)) ; xut[0] = xin[0] ; *xout = xut ;
00793 yut = (int *) malloc(sizeof(int)) ; yut[0] = yin[0] ; *yout = yut ;
00794 zut = (int *) malloc(sizeof(int)) ; zut[0] = zin[0] ; *zout = zut ;
00795 EXRETURN ;
00796 }
00797
00798 /* setup to scan through lines */
00799
00800 nall = nin ;
00801 xut = (int *) malloc( sizeof(int) * nall ) ;
00802 yut = (int *) malloc( sizeof(int) * nall ) ;
00803 zut = (int *) malloc( sizeof(int) * nall ) ;
00804 nut = 0 ;
00805
00806 #undef ADDPT
00807 #define ADDPT(i,j,k) \
00808 do{ if( nut == nall ){ \
00809 nall += 128 ; \
00810 xut = (int *) realloc( xut , sizeof(int) * nall ) ; \
00811 yut = (int *) realloc( yut , sizeof(int) * nall ) ; \
00812 zut = (int *) realloc( zut , sizeof(int) * nall ) ; \
00813 } \
00814 xut[nut] = xlast = (i) ; \
00815 yut[nut] = ylast = (j) ; \
00816 zut[nut] = zlast = (k) ; nut++ ; } while(0)
00817
00818 /* draw line from point #iin to #iin+1 */
00819
00820 x2 = xin[0] ; y2 = yin[0] ; z2 = zin[0] ;
00821 for( iin=0 ; iin < nin-1 ; iin++ ){
00822 x1 = x2 ; y1 = y2 ; z1 = z2 ;
00823 x2 = xin[iin+1] ; y2 = yin[iin+1] ; z2 = zin[iin+1] ;
00824 dx = x2 - x1 ; dy = y2 - y1 ; dz = z2 - z1 ;
00825 adx = abs(dx) ; ady = abs(dy) ; adz = abs(dz) ;
00826
00827 /* add start point to list */
00828
00829 ADDPT(x1,y1,z1) ;
00830
00831 /* special case: neighbors ==> skip to next line */
00832
00833 if( adx <= 1 && ady <= 1 && adz <= 1 ) continue ;
00834
00835 /* OK, we have to do work (moan) */
00836
00837 #define SFRAC 0.495
00838
00839 fdxyz = adx + ady + adz ; /* Manhattan distance */
00840 fdx = SFRAC * dx / fdxyz ; /* steps */
00841 fdy = SFRAC * dy / fdxyz ;
00842 fdz = SFRAC * dz / fdxyz ;
00843
00844 /* step thru in small increments,
00845 adding new integer points, and stopping at line's end */
00846
00847 #if 0
00848 fprintf(stderr,"linefill: from %d %d %d to %d %d %d\n",
00849 x1,y1,z1 , x2,y2,z2 ) ;
00850 #endif
00851
00852 fx = x1+fdx+0.499 ; fy = y1+fdy+0.499 ; fz = z1+fdz+0.499 ;
00853 do {
00854 fx = fx + fdx ; fy = fy + fdy ; fz = fz + fdz ;
00855 x1 = (int) fx ; y1 = (int) fy ; z1 = (int) fz ;
00856
00857 #if 0
00858 fprintf(stderr," at %d %d %d\n",x1,y1,z1) ;
00859 #endif
00860
00861 if( x1 == x2 && y1 == y2 && z1 == z2 ) break ;
00862
00863 if( x1 != xlast || y1 != ylast || z1 != zlast ) ADDPT(x1,y1,z1) ;
00864 } while(1) ;
00865
00866 } /* end of loop over lines */
00867
00868 ADDPT(x2,y2,z2) ; /* add last point */
00869
00870 *nout = nut ; *xout = xut ; *yout = yut ; *zout = zut ;
00871 EXRETURN ;
00872 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 923 of file afni_receive.c. References ISVALID_DSET, TEMP_FVEC3, THD_3dmm_to_dicomm(), and THD_fvec3::xyz.
00926 {
00927 THD_fvec3 fv ;
00928
00929 if( ! ISVALID_DSET(dset) ) return ;
00930
00931 fv = THD_3dmm_to_dicomm( dset , TEMP_FVEC3(xd,yd,zd) ) ;
00932 *xx = fv.xyz[0] ;
00933 *yy = fv.xyz[1] ;
00934 *zz = fv.xyz[2] ;
00935 return ;
00936 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 878 of file afni_receive.c. References ISVALID_DSET, TEMP_IVEC3, THD_3dind_to_3dmm(), and THD_fvec3::xyz.
00881 {
00882 THD_fvec3 fv ;
00883
00884 if( ! ISVALID_DSET(dset) ) return ;
00885
00886 fv = THD_3dind_to_3dmm( dset , TEMP_IVEC3(ii,jj,kk) ) ;
00887 *xx = fv.xyz[0] ;
00888 *yy = fv.xyz[1] ;
00889 *zz = fv.xyz[2] ;
00890 return ;
00891 }
|
|
|
Definition at line 427 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, ENTRY, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_ALTERATION, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, STATUS, and Three_D_View::vinfo. Referenced by AFNI_underlay_CB().
00428 {
00429 int ir ;
00430
00431 ENTRY("AFNI_process_alteration") ;
00432
00433 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00434 im3d->vinfo->num_receiver == 0 ) EXRETURN ;
00435
00436 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00437 if( im3d->vinfo->receiver[ir] != NULL ){
00438 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00439 #if 0
00440 im3d->vinfo->receiver[ir]->receiver_func(
00441 RECEIVE_ALTERATION , 0 , NULL ,
00442 im3d->vinfo->receiver[ir]->receiver_data ) ;
00443 #else
00444 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00445 int,RECEIVE_ALTERATION , int,0 ,
00446 void *,NULL ,
00447 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00448 #endif
00449 }
00450 }
00451
00452 EXRETURN ;
00453 }
|
|
||||||||||||||||||||||||||||
|
Process drawn points:
Definition at line 683 of file afni_receive.c. References AFNI_3d_linefill(), AFNI_CALL_VOID_4ARG, AFNI_process_drawnotice(), AFNI_view_info::drawing_enabled, DRAWING_FILL, DRAWING_LINES, AFNI_view_info::drawing_mode, DRAWING_NODRAW, DRAWING_POINTS, ENTRY, free, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_DRAWING_MASK, RECEIVE_POINTS, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, STATUS, Three_D_View::vinfo, xn, yn, and zn. Referenced by AFNI_gra_send_CB(), and AFNI_seq_send_CB().
00685 {
00686 int ii , nn , ir , nsent ;
00687 int *vp[4] , *xn=NULL , *yn=NULL , *zn=NULL ;
00688
00689 ENTRY("AFNI_process_drawing") ;
00690
00691 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00692 im3d->vinfo->num_receiver == 0 ||
00693 npts < 0 || im3d->vinfo->drawing_enabled == 0 ) EXRETURN ;
00694
00695 if(PRINT_TRACING){
00696 char str[256] ; sprintf(str,"received %d points",npts) ; STATUS(str) ;
00697 }
00698
00699 /*-- if no further treatment is needed,
00700 just flag input data to be set to receiver --*/
00701
00702 if( im3d->vinfo->drawing_mode == DRAWING_POINTS ||
00703 im3d->vinfo->drawing_mode == DRAWING_NODRAW || npts <= 1 ){
00704
00705 xn = xd ; yn = yd ; zn = zd ; nn = npts ;
00706 }
00707
00708 /*-- must fill in the lines:
00709 create arrays xn, yn, zn of length nn --*/
00710
00711 else if( im3d->vinfo->drawing_mode == DRAWING_LINES ){
00712
00713 AFNI_3d_linefill( npts , xd,yd,zd , &nn , &xn , &yn , &zn ) ;
00714 }
00715
00716 /*-- must fill in the polygon --*/
00717
00718 else if( im3d->vinfo->drawing_mode == DRAWING_FILL ){
00719
00720 /* this just fills the lines like above --
00721 need to write a real polygon filling routine? */
00722
00723 AFNI_3d_linefill( npts , xd,yd,zd , &nn , &xn , &yn , &zn ) ;
00724 }
00725
00726 /*-- send data to receivers that want it --*/
00727
00728 #if 0
00729 fprintf(stderr,"Sending %d points to receiver\n",nn) ;
00730 #endif
00731
00732 vp[3] = &mode ; /* how the points are arranged */
00733
00734 vp[0] = xn ; vp[1] = yn ; vp[2] = zn ;
00735
00736 for( nsent=ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00737
00738 if( im3d->vinfo->receiver[ir] != NULL &&
00739 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_DRAWING_MASK) ){
00740
00741 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00742 #if 0
00743 im3d->vinfo->receiver[ir]->receiver_func(
00744 RECEIVE_POINTS , nn ,
00745 (void *) vp , im3d->vinfo->receiver[ir]->receiver_data ) ;
00746 #else
00747 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00748 int,RECEIVE_POINTS , int,nn ,
00749 void *,vp ,
00750 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00751 #endif
00752 nsent++ ;
00753 }
00754 }
00755
00756 /* 30 Mar 1999: also send DRAWNOTICE to receivers that like this stuff */
00757
00758 if( nsent > 0 ) AFNI_process_drawnotice( im3d ) ;
00759
00760 /*-- free any created arrays --*/
00761
00762 if( xn != xd ){ free(xn); free(yn); free(zn); }
00763 EXRETURN ;
00764 }
|
|
|
|
|
Send funcdisplay notification to receivers that care [05 Mar 2002]. --------------------------------------------------------------------- Definition at line 635 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, ENTRY, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_FUNCDISPLAY, RECEIVE_FUNCDISPLAY_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, STATUS, and Three_D_View::vinfo. Referenced by AFNI_bucket_CB(), AFNI_redisplay_func(), and AFNI_time_index_CB().
00636 {
00637 int ir ;
00638
00639 ENTRY("AFNI_process_funcdisplay") ;
00640
00641 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00642 im3d->vinfo->num_receiver == 0 ) EXRETURN ;
00643
00644 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00645 if( im3d->vinfo->receiver[ir] != NULL &&
00646 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_FUNCDISPLAY_MASK) ){
00647
00648 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00649 #if 0
00650 im3d->vinfo->receiver[ir]->receiver_func(
00651 RECEIVE_FUNCDISPLAY , 0 , NULL ,
00652 im3d->vinfo->receiver[ir]->receiver_data ) ;
00653 #else
00654 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00655 int,RECEIVE_FUNCDISPLAY , int,0 ,
00656 void *,NULL ,
00657 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00658 #endif
00659 }
00660 }
00661
00662 EXRETURN ;
00663 }
|
|
|
Send redisplay notification to receivers that care [04 Mar 2002]. --------------------------------------------------------------------- Definition at line 601 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, ENTRY, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_REDISPLAY, RECEIVE_REDISPLAY_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, STATUS, and Three_D_View::vinfo. Referenced by AFNI_set_viewpoint().
00602 {
00603 int ir ;
00604
00605 ENTRY("AFNI_process_redisplay") ;
00606
00607 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00608 im3d->vinfo->num_receiver == 0 ) EXRETURN ;
00609
00610 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00611 if( im3d->vinfo->receiver[ir] != NULL &&
00612 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_REDISPLAY_MASK) ){
00613
00614 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00615 #if 0
00616 im3d->vinfo->receiver[ir]->receiver_func(
00617 RECEIVE_REDISPLAY , 0 , NULL ,
00618 im3d->vinfo->receiver[ir]->receiver_data ) ;
00619 #else
00620 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00621 int,RECEIVE_REDISPLAY , int,0 ,
00622 void *,NULL ,
00623 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00624 #endif
00625 }
00626 }
00627
00628 EXRETURN ;
00629 }
|
|
|
Send time index change notice to receivers that care [29 Jan 2003] --------------------------------------------------------------------- Definition at line 567 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, ENTRY, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_TIMEINDEX, RECEIVE_TIMEINDEX_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, STATUS, and Three_D_View::vinfo. Referenced by AFNI_setup_viewing(), and AFNI_time_index_CB().
00568 {
00569 int ir ;
00570
00571 ENTRY("AFNI_process_timeindex") ;
00572
00573 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00574 im3d->vinfo->num_receiver == 0 ) EXRETURN ;
00575
00576 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00577 if( im3d->vinfo->receiver[ir] != NULL &&
00578 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_TIMEINDEX_MASK) ){
00579
00580 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00581 #if 0
00582 im3d->vinfo->receiver[ir]->receiver_func(
00583 RECEIVE_TIMEINDEX , 0 , NULL ,
00584 im3d->vinfo->receiver[ir]->receiver_data ) ;
00585 #else
00586 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00587 int,RECEIVE_TIMEINDEX , int,0 ,
00588 void *,NULL ,
00589 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00590 #endif
00591 }
00592 }
00593
00594 EXRETURN ;
00595 }
|
|
|
Definition at line 529 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, ENTRY, AFNI_view_info::i1, IM3D_VALID, AFNI_view_info::j2, AFNI_view_info::k3, AFNI_view_info::num_receiver, RECEIVE_VIEWPOINT, RECEIVE_VIEWPOINT_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, STATUS, and Three_D_View::vinfo. Referenced by AFNI_crosshair_visible_CB(), and AFNI_set_viewpoint().
00530 {
00531 int ir , ijk[3] ;
00532
00533 ENTRY("AFNI_process_viewpoint") ;
00534
00535 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00536 im3d->vinfo->num_receiver == 0 ) EXRETURN ;
00537
00538 ijk[0] = im3d->vinfo->i1 ;
00539 ijk[1] = im3d->vinfo->j2 ;
00540 ijk[2] = im3d->vinfo->k3 ;
00541
00542 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00543 if( im3d->vinfo->receiver[ir] != NULL &&
00544 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_VIEWPOINT_MASK) ){
00545
00546 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00547 #if 0
00548 im3d->vinfo->receiver[ir]->receiver_func(
00549 RECEIVE_VIEWPOINT , 3 , ijk ,
00550 im3d->vinfo->receiver[ir]->receiver_data ) ;
00551 #else
00552 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00553 int,RECEIVE_VIEWPOINT , int,3 ,
00554 void *,ijk ,
00555 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00556 #endif
00557 }
00558 }
00559
00560 EXRETURN ;
00561 }
|
|
||||||||||||||||||||
|
Control how the receiver works:
Definition at line 183 of file afni_receive.c. References AFNI_toggle_drawing(), arg, Three_D_View::dc, DRAWING_FILL, DRAWING_LINES, DRAWING_LINEWIDTH, AFNI_view_info::drawing_mode, DRAWING_NODRAW, DRAWING_OVCINDEX, AFNI_view_info::drawing_pixel, DRAWING_POINTS, DRAWING_SHUTDOWN, DRAWING_STARTUP, DRAWING_X11PIXEL, DRAWNOTICE_SHUTDOWN, DRAWNOTICE_STARTUP, drive_MCW_imseq(), DSETCHANGE_SHUTDOWN, DSETCHANGE_STARTUP, ENTRY, EVERYTHING_SHUTDOWN, free, FUNCDISPLAY_SHUTDOWN, FUNCDISPLAY_STARTUP, IM3D_VALID, ind, isqDR_button2_mode, isqDR_button2_pixel, isqDR_button2_width, key, MCW_DCOV::ncol_ov, AFNI_view_info::num_receiver, MCW_DC::ovc, OVERLAY_SHUTDOWN, OVERLAY_STARTUP, MCW_DCOV::pix_ov, RECEIVE_ALL_MASK, RECEIVE_DRAWING_MASK, RECEIVE_DRAWNOTICE_MASK, RECEIVE_DSETCHANGE_MASK, RECEIVE_FUNCDISPLAY_MASK, RECEIVE_OVERLAY_MASK, RECEIVE_REDISPLAY_MASK, RECEIVE_TIMEINDEX_MASK, RECEIVE_VIEWPOINT_MASK, AFNI_view_info::receiver, REDISPLAY_SHUTDOWN, REDISPLAY_STARTUP, RETURN, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, TIMEINDEX_SHUTDOWN, TIMEINDEX_STARTUP, VIEWPOINT_SHUTDOWN, VIEWPOINT_STARTUP, and Three_D_View::vinfo. Referenced by DRAW_color_CB(), DRAW_done_CB(), DRAW_finalize_dset_CB(), DRAW_mode_CB(), DRAW_quit_CB(), DSET2_dset_recv(), DSETN_dset_recv(), r_save_dataset_as(), RCREND_done_CB(), REND_done_CB(), and TTget_main().
00184 {
00185 ENTRY("AFNI_receive_control") ;
00186
00187 /* check input for OK-osity */
00188
00189 if( ! IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ) RETURN(-1) ;
00190 if( key < 0 || key >= im3d->vinfo->num_receiver ) RETURN(-1) ;
00191 if( im3d->vinfo->receiver[key] == NULL ) RETURN(-1) ;
00192
00193 /* take appropriate actions */
00194
00195 switch( code ){
00196
00197 default: RETURN(-1) ;
00198
00199 case DRAWNOTICE_STARTUP:{ /* 30 Mar 1999 */
00200 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_DRAWNOTICE_MASK ;
00201 }
00202 break ;
00203
00204 case DRAWNOTICE_SHUTDOWN:{ /* 30 Mar 1999 */
00205 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_DRAWNOTICE_MASK) ;
00206 }
00207 break ;
00208
00209 case DSETCHANGE_STARTUP:{ /* 31 Mar 1999 */
00210 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_DSETCHANGE_MASK ;
00211 }
00212 break ;
00213
00214 case DSETCHANGE_SHUTDOWN:{ /* 30 Mar 1999 */
00215 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_DSETCHANGE_MASK) ;
00216 }
00217 break ;
00218
00219 case DRAWING_STARTUP:{
00220 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_DRAWING_MASK ;
00221 AFNI_toggle_drawing( im3d ) ;
00222 }
00223 break ;
00224
00225 case DRAWING_SHUTDOWN:{
00226 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_DRAWING_MASK) ;
00227 AFNI_toggle_drawing( im3d ) ;
00228 }
00229 break ;
00230
00231 case DRAWING_OVCINDEX:{
00232 int ind = (int) arg ;
00233
00234 if( ind <= 0 || ind >= im3d->dc->ovc->ncol_ov ){
00235 RETURN(-1) ;
00236 } else {
00237 Pixel ppp = im3d->dc->ovc->pix_ov[ind] ;
00238 drive_MCW_imseq( im3d->s123, isqDR_button2_pixel, (XtPointer)ppp ) ;
00239 drive_MCW_imseq( im3d->s231, isqDR_button2_pixel, (XtPointer)ppp ) ;
00240 drive_MCW_imseq( im3d->s312, isqDR_button2_pixel, (XtPointer)ppp ) ;
00241 im3d->vinfo->drawing_pixel = ppp ;
00242 }
00243 }
00244 break ;
00245
00246 case DRAWING_X11PIXEL:{
00247 Pixel ppp = (Pixel) arg ;
00248 drive_MCW_imseq( im3d->s123, isqDR_button2_pixel, (XtPointer)ppp ) ;
00249 drive_MCW_imseq( im3d->s231, isqDR_button2_pixel, (XtPointer)ppp ) ;
00250 drive_MCW_imseq( im3d->s312, isqDR_button2_pixel, (XtPointer)ppp ) ;
00251 im3d->vinfo->drawing_pixel = ppp ;
00252 }
00253 break ;
00254
00255 case DRAWING_LINES:
00256 case DRAWING_FILL:
00257 case DRAWING_POINTS:
00258 case DRAWING_NODRAW:{
00259 im3d->vinfo->drawing_mode = code ;
00260 drive_MCW_imseq( im3d->s123, isqDR_button2_mode, (XtPointer)code ) ;
00261 drive_MCW_imseq( im3d->s231, isqDR_button2_mode, (XtPointer)code ) ;
00262 drive_MCW_imseq( im3d->s312, isqDR_button2_mode, (XtPointer)code ) ;
00263 }
00264 break ;
00265
00266 case DRAWING_LINEWIDTH:{ /* 08 Oct 2002 */
00267 int ww = (int) arg ;
00268 if( ww >= 0 ){
00269 drive_MCW_imseq( im3d->s123, isqDR_button2_width, (XtPointer)ww ) ;
00270 drive_MCW_imseq( im3d->s231, isqDR_button2_width, (XtPointer)ww ) ;
00271 drive_MCW_imseq( im3d->s312, isqDR_button2_width, (XtPointer)ww ) ;
00272 }
00273 }
00274 break ;
00275
00276 case VIEWPOINT_STARTUP:{
00277 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_VIEWPOINT_MASK ;
00278 }
00279 break ;
00280
00281 case VIEWPOINT_SHUTDOWN:{
00282 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_VIEWPOINT_MASK) ;
00283 }
00284 break ;
00285
00286 case REDISPLAY_STARTUP:{
00287 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_REDISPLAY_MASK ;
00288 }
00289 break ;
00290
00291 case REDISPLAY_SHUTDOWN:{
00292 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_REDISPLAY_MASK) ;
00293 }
00294 break ;
00295
00296 case FUNCDISPLAY_STARTUP:{
00297 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_FUNCDISPLAY_MASK ;
00298 }
00299 break ;
00300
00301 case FUNCDISPLAY_SHUTDOWN:{
00302 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_FUNCDISPLAY_MASK) ;
00303 }
00304 break ;
00305
00306 case OVERLAY_STARTUP:{
00307 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_OVERLAY_MASK ;
00308 }
00309 break ;
00310
00311 case OVERLAY_SHUTDOWN:{
00312 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_OVERLAY_MASK) ;
00313 }
00314 break ;
00315
00316 case TIMEINDEX_STARTUP:{
00317 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_TIMEINDEX_MASK ;
00318 }
00319 break ;
00320
00321 case TIMEINDEX_SHUTDOWN:{
00322 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_TIMEINDEX_MASK) ;
00323 }
00324 break ;
00325
00326 case EVERYTHING_SHUTDOWN:{
00327 im3d->vinfo->receiver[key]->receiver_mask = 0 ;
00328 AFNI_toggle_drawing( im3d ) ;
00329 }
00330 break ;
00331
00332 } /* end of switch on codes */
00333
00334 /* possibly remove this receiver, and maybe even all receivers */
00335
00336 if( im3d->vinfo->receiver[key]->receiver_mask == 0 ){ /* receiving nothing at all? */
00337 int ir , nn=0 ;
00338
00339 if( im3d->vinfo->receiver[key]->receiver_funcname != NULL )
00340 free( im3d->vinfo->receiver[key]->receiver_funcname ) ;
00341
00342 free( im3d->vinfo->receiver[key] ) ; /* toss this one fer shur */
00343 im3d->vinfo->receiver[key] = NULL ;
00344
00345 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ) /* see if any are left */
00346 if( im3d->vinfo->receiver[ir] != NULL ) nn++ ;
00347
00348 if( nn == 0 ) im3d->vinfo->num_receiver = 0 ; /* if not, toss them all */
00349 }
00350
00351 RETURN(0) ;
00352 }
|
|
|
Turn off all reception for this viewer. --------------------------------------------------------------------------- Definition at line 135 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, AFNI_view_info::drawing_enabled, DRAWING_LINES, AFNI_view_info::drawing_mode, ENTRY, free, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_CLOSURE, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, and Three_D_View::vinfo. Referenced by AFNI_closedown_3dview().
00136 {
00137 int ir ;
00138
00139 ENTRY("AFNI_receive_destroy") ;
00140
00141 if( !IM3D_VALID(im3d) ) EXRETURN ;
00142
00143 if( im3d->vinfo->receiver != NULL && im3d->vinfo->num_receiver > 0 ){
00144
00145 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00146
00147 if( im3d->vinfo->receiver[ir] != NULL ){
00148 #if 0
00149 im3d->vinfo->receiver[ir]->receiver_func(
00150 RECEIVE_CLOSURE , 0 , NULL ,
00151 im3d->vinfo->receiver[ir]->receiver_data ) ;
00152 #else
00153 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00154 int,RECEIVE_CLOSURE , int,0 ,
00155 void *,NULL ,
00156 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00157 #endif
00158
00159 if( im3d->vinfo->receiver[ir]->receiver_funcname != NULL )
00160 free( im3d->vinfo->receiver[ir]->receiver_funcname ) ;
00161 free( im3d->vinfo->receiver[ir] ) ;
00162 im3d->vinfo->receiver[ir] = NULL ;
00163 }
00164 }
00165
00166 im3d->vinfo->num_receiver = 0 ;
00167 im3d->vinfo->drawing_enabled = 0 ;
00168 im3d->vinfo->drawing_mode = DRAWING_LINES ; /* default */
00169 }
00170
00171 EXRETURN ;
00172 }
|
|
||||||||||||||||||||||||
|
Set up to have AFNI send data to a receiver: rmask = bitwise OR (|) mask of RECEIVE_*_MASK (cf. afni.h) cb = callback function to receive data; will be called like cb( int why , int np , void * vp , void * cb_data ) where why = a RECEIVE_* code (cf. below) np = count of data in vp (may be 0) vp = pointer to data being sent (may be NULL) cb_data = pointer passed into this routine cbname = string to identify callback func (for debugging) why = RECEIVE_VIEWPOINT --> np = 3, vp = int *, pointing to array of dataset voxel indices just jumped to; vp[0] = x index, etc. why = RECEIVE_REDISPLAY --> the user did something to cause an image redisplay besides changing the viewpoint. For this call, np and vp are unused. why = RECEIVE_FUNCDISPLAY --> the user did something to cause the function display to change. For this call, np and vp are unused. why = RECEIVE_POINTS --> np = number of points drawn vp = int **, pointer to array of arrays of dataset voxel indices: vp[0][i] = x index of point i vp[1][i] = y index of point i vp[2][i] = z index of point i, vp[3][0] = sending mode for i=0..np-1 why = RECEIVE_DRAWNOTICE --> the user drew something and that information was sent to a receiver. This call will occur AFTER all the RECEIVE_POINTS calls have been done. If no RECEIVE_POINTS calls are made, then no RECEIVE_DRAWNOTICE calls will be made either. For this call, np and vp are unused. why = RECEIVE_DSETCHANGE --> the user did something (like rescan a session) that may have changed dataset pointers. The receiving routine should use dataset idcodes to re-find the correct dataset pointers. For this call, np and vp are unused. why = RECEIVE_CLOSURE --> the user closed the controller window, which means that no more data will be coming from it -- even if it is reopened, AFNI_receive_init must be called again. For this call, np and vp are unused. why = RECEIVE_ALTERATION --> the user changed something in the controller -- the dataset, the time index, the resampling, .... This is basically a warning message. For this call, np and vp are unused. why = RECEIVE_TIMEINDEX --> the time index changed in im3d; for this call, np,vp are unused. The new time index is in im3d->vinfo->time_index This function returns a non-negative int if all is OK -- this value is the "key" that is used in calls to AFNI_receive_control when you want to manipulate the status of this connection. This function returns -1 if an error occurs. Modified 29 Mar 1999 to allow for multiple receivers (but drawing can only be done in one mode). --------------------------------------------------------------------- Definition at line 93 of file afni_receive.c. References AFMALL, AFNI_toggle_drawing(), AFREALL, ENTRY, gen_func, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_ALL_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, RETURN, and Three_D_View::vinfo. Referenced by AFNI_init_niml(), DRAW_finalize_dset_CB(), DSET2_main(), DSETN_main(), RCREND_main(), REND_main(), and TTget_main().
00095 {
00096 int ir ;
00097
00098 ENTRY("AFNI_receive_init") ;
00099
00100 /* check for invalid entries */
00101
00102 if( ! IM3D_VALID(im3d) || /* no good? */
00103 cb == NULL || /* no receiver? */
00104 (rmask & RECEIVE_ALL_MASK) == 0 ) RETURN(-1) ; /* no action? */
00105
00106 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ )
00107 if( im3d->vinfo->receiver[ir] == NULL ) break ;
00108
00109 if( ir == im3d->vinfo->num_receiver ){
00110 #if 0
00111 fprintf(stderr,"AFNI_receive_init AFREALL() with ir=%d num_receiver=%d\n",
00112 ir,im3d->vinfo->num_receiver ) ;
00113 #endif
00114 im3d->vinfo->receiver = AFREALL( im3d->vinfo->receiver, AFNI_receiver *, ir+1 );
00115 im3d->vinfo->num_receiver ++ ;
00116 }
00117 im3d->vinfo->receiver[ir] = AFMALL( AFNI_receiver, sizeof(AFNI_receiver)) ;
00118
00119 im3d->vinfo->receiver[ir]->receiver_func = cb ;
00120 im3d->vinfo->receiver[ir]->receiver_mask = rmask ;
00121 im3d->vinfo->receiver[ir]->receiver_data = cb_data ;
00122
00123 im3d->vinfo->receiver[ir]->receiver_funcname =
00124 strdup( (cbname != NULL) ? cbname : "[unknown func]" ) ;
00125
00126 AFNI_toggle_drawing( im3d ) ;
00127
00128 RETURN(ir) ; /* 15 Jun 1999: used to return 0, which is not correct! */
00129 }
|
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 908 of file afni_receive.c. References ISVALID_DSET, TEMP_FVEC3, THD_3dmm_to_dicomm(), and THD_fvec3::xyz.
00911 {
00912 THD_fvec3 fv ;
00913
00914 if( ! ISVALID_DSET(dset) ) return ;
00915
00916 fv = THD_3dmm_to_dicomm( dset , TEMP_FVEC3(xx,yy,zz) ) ;
00917 *xd = fv.xyz[0] ;
00918 *yd = fv.xyz[1] ;
00919 *zd = fv.xyz[2] ;
00920 return ;
00921 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 893 of file afni_receive.c. References THD_ivec3::ijk, ISVALID_DSET, TEMP_FVEC3, and THD_3dmm_to_3dind().
00896 {
00897 THD_ivec3 iv ;
00898
00899 if( ! ISVALID_DSET(dset) ) return ;
00900
00901 iv = THD_3dmm_to_3dind ( dset , TEMP_FVEC3(xx,yy,zz) ) ;
00902 *ii = iv.ijk[0] ;
00903 *jj = iv.ijk[1] ;
00904 *kk = iv.ijk[2] ;
00905 return ;
00906 }
|