/* @(#)Select.c 1.15 02 Mar 1995 */ /*----------------------------------------------------------------------------- Copyright (C) 1993, Molecular Structure Group of Biochemestry Dept. at University of California at San Francisco. These coded instructions, statements, and computer programs comprise unpublished proprietary information of the Molecular Structure Group of the Biochemistry Department at University of California at San Francisco, and are protected by Federal copyright law. They may not be disclosed to third parties, copied or duplicated in any form - in whole or in part - without the prior written consent of Molecular Structure Group of Biochemistry Department at University of California at San Francisco. -------------------------------------------------------------------------*/ #include "IWInclude.h" #include "WMInclude.h" #include "ip.h" static float gfThreshold; static char gsThreshold[20]; ProcData(nxyz, dmmm) int nxyz[3]; float dmmm[3]; { int i,ix,j,iy,imy,ipy,npix; int nxy; float *des; float *src; src =(float *) IPGetDataPtr( 1 ); des =(float *) IPGetDataPtr( 2 ); imy = 0; iy = nxyz[0]; ipy = nxyz[0] * 2; npix = 0; for(j = 1; j < nxyz[1]-1; j++) { for(i=1;i < nxyz[0]-1; i++) { ix = i + iy; des[ ix ] = 0; if( src[ix ] >= gfThreshold ) { if( src[ ix - 1] < gfThreshold || src[ ix + 1 ] < gfThreshold || src[ i + ipy ] < gfThreshold || src[ i + imy] < gfThreshold ) { des[ ix ] = 1; npix++; } } } iy = iy + nxyz[0]; imy = imy + nxyz[0]; ipy = ipy + nxyz[0]; } dmmm[2] = dmmm[2] + npix; dmmm[0] = 0; dmmm[1] = 1; return; } void GetString() { float dummy; if( sscanf( gsThreshold, "%g", &dummy ) == 1 ) { gfThreshold = dummy; } else { sprintf( gsThreshold, "%g", gfThreshold ); WMUpdateGroup( 4 ); } printf(" threshold= %f\n",gfThreshold); } void SetMenu() { WMAddInfoButton("Threshold:","FINDBORDER threshold"); WMAddCharField(gsThreshold, 25, 25, GetString, NULL, 0, 4); WMNewRow(); } IPAppSpecifics() { strcpy( gsThreshold, " "); IPSetMenuTitle("Find Border"); IPSetMenuLoc(450, 400); IPAddInput( one, " In:", True, False, NULL, NULL); IPAddOutput(two, "Out:", True, False, NULL, NULL); IPSetCustRoutine(CUS_MENU,SetMenu,NULL); IPSetCustRoutine(PROC_FUNC, ProcData, NULL); }