/************************************************************************/ /* */ /* Program: extract.c */ /* Purpose: to extract a 3-D volume subset from a larger 3-D */ /* volume */ /* Input and Output files: 3-D images one character per voxel */ /* Programmer: Dale P. Bentz */ /* National Institute of Standards and Technology */ /* 100 Bureau Drive Stop 8621 */ /* Gaithersburg, MD 20899-8621 */ /* Phone: (301) 975-5865 */ /* Fax: (301) 990-6891 */ /* E-mail: dale.bentz@nist.gov */ /* */ /* Date: 2001 */ /* */ /***********************************************************************/ #include #include #include main(){ FILE *infile,*outfile; char filein[80],fileout[80]; int iskip,ktrue,jtrue; int i,j,k; int xsize,ysize,zsize,xcent,ycent,zcent; int xred,yred,zred,xlo,xhi,ylo,yhi,zlo,zhi; char valin; /* Get user inputs */ printf("Enter name of file to read from \n"); scanf("%s",filein); printf("%s\n",filein); infile=fopen(filein,"rb"); printf("Enter name of file to create \n"); scanf("%s",fileout); printf("%s\n",fileout); outfile=fopen(fileout,"wb"); printf("It is assumed that in the starting 3-D image file \n"); printf("x varies the fastest, then y, then z. \n\n"); printf("Enter center coordinates in starting image for new image subset (x, y, and z) \n"); scanf("%d %d %d",&xcent,&ycent,&zcent); printf("%d %d %d\n",xcent,ycent,zcent); printf("Enter size of original image (x y z) \n"); scanf("%d %d %d",&xsize,&ysize,&zsize); printf("%d %d %d\n",xsize,ysize,zsize); printf("Enter number of pixels to skip (if any) at beginning of file \n"); scanf("%d",&iskip); printf("%d\n",iskip); for(i=0;i=zlo)&&(k=ylo)&&(j=xlo)&&(i