1 | /* |
---|
2 | |
---|
3 | Name: getinfo.c |
---|
4 | |
---|
5 | Coded: Paul Ning |
---|
6 | |
---|
7 | Modified by: Brian Curless |
---|
8 | Computer Graphics Laboratory |
---|
9 | Stanford University |
---|
10 | |
---|
11 | Comment: Get essential information. |
---|
12 | |
---|
13 | Copyright (1997) The Board of Trustees of the Leland Stanford Junior |
---|
14 | University. Except for commercial resale, lease, license or other |
---|
15 | commercial transactions, permission is hereby given to use, copy, |
---|
16 | modify this software for academic purposes only. No part of this |
---|
17 | software or any derivatives thereof may be used in the production of |
---|
18 | computer models for resale or for use in a commercial |
---|
19 | product. STANFORD MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND |
---|
20 | CONCERNING THIS SOFTWARE. No support is implied or provided. |
---|
21 | |
---|
22 | */ |
---|
23 | |
---|
24 | |
---|
25 | #include <stdio.h> |
---|
26 | #include "mc.h" |
---|
27 | |
---|
28 | void GetInfo() |
---|
29 | { |
---|
30 | FILE *paramfile; |
---|
31 | Boolean WriteParams; |
---|
32 | char answer; |
---|
33 | |
---|
34 | printf("\n"); |
---|
35 | printf(" ***** Welcome to MC Version 2.0 *****\n"); |
---|
36 | printf("\n"); |
---|
37 | printf("This program performs Marching Cubes reconstruction of contour\n"); |
---|
38 | printf("surfaces. The input data set consists of a sequence of 2-D\n"); |
---|
39 | printf("slices taken from some 3-D object.\n\n"); |
---|
40 | |
---|
41 | if (!(paramfile = fopen("mc.par","w"))) { |
---|
42 | WriteParams = FALSE; |
---|
43 | printf(" Error in opening \"mc.par\". Parameters will not be\n"); |
---|
44 | printf(" written to file\n\n"); |
---|
45 | } else { |
---|
46 | WriteParams = TRUE; |
---|
47 | printf(" Input parameters will be written to file \"mc.par\".\n\n"); |
---|
48 | } |
---|
49 | |
---|
50 | WriteParams = FALSE; |
---|
51 | |
---|
52 | printf("1) <input_root> file name?\n>"); |
---|
53 | answer = (char) getchar(); |
---|
54 | while (answer != '\n') { |
---|
55 | infile[strlen(infile)] = answer; |
---|
56 | answer = (char) getchar(); |
---|
57 | } |
---|
58 | printf("%s\n",infile); |
---|
59 | if (WriteParams) |
---|
60 | fprintf(paramfile, "%s\n",infile); |
---|
61 | |
---|
62 | printf("2) <number> of first file?\n>"); |
---|
63 | scanf("%d",&FirstSliceFileNumber); |
---|
64 | printf("%d\n",FirstSliceFileNumber); |
---|
65 | if (WriteParams) |
---|
66 | fprintf(paramfile, "%d\n",FirstSliceFileNumber); |
---|
67 | |
---|
68 | printf("3) Number of image planes?\n>"); |
---|
69 | scanf("%d",&Nslice); |
---|
70 | printf("%d\n",Nslice); |
---|
71 | if (WriteParams) |
---|
72 | fprintf(paramfile, "%d\n",Nslice); |
---|
73 | |
---|
74 | printf("4) Row and column dimensions of cross sections? <row> <column>\n>"); |
---|
75 | scanf("%d %d",&Nrow,&Ncol); |
---|
76 | printf("%d %d\n",Nrow,Ncol); |
---|
77 | if (WriteParams) |
---|
78 | fprintf(paramfile, "%d %d\n",Nrow,Ncol); |
---|
79 | |
---|
80 | printf("5) Separation between adjacent image planes?\n>"); |
---|
81 | scanf("%f",&dslice); |
---|
82 | printf("%f\n",dslice); |
---|
83 | if (WriteParams) |
---|
84 | fprintf(paramfile, "%f\n",dslice); |
---|
85 | |
---|
86 | printf("6) Separation between samples in adjacent rows and columns?\n"); |
---|
87 | printf(" <row separation> <column separation>\n>"); |
---|
88 | scanf("%f %f",&drow,&dcol); |
---|
89 | printf("%f %f\n",drow,dcol); |
---|
90 | if (WriteParams) |
---|
91 | fprintf(paramfile, "%f %f\n",drow,dcol); |
---|
92 | |
---|
93 | printf("7) <output_root> file name?\n>"); |
---|
94 | answer = (char) getchar(); |
---|
95 | answer = (char) getchar(); |
---|
96 | while (answer != '\n') { |
---|
97 | outfile[strlen(outfile)] = answer; |
---|
98 | answer = (char) getchar(); |
---|
99 | } |
---|
100 | printf("%s\n",outfile); |
---|
101 | if (WriteParams) |
---|
102 | fprintf(paramfile, "%s\n",outfile); |
---|
103 | |
---|
104 | printf("8) Reconstruct part of surface? {y/n}\n>"); |
---|
105 | scanf("%1s",&answer); |
---|
106 | printf("%c\n",answer); |
---|
107 | if (WriteParams) |
---|
108 | fprintf(paramfile, "%c\n",answer); |
---|
109 | if (answer == 'n') { |
---|
110 | i0 = j_0 = k0 = 1; |
---|
111 | i1 = Nslice - 2; |
---|
112 | j_1 = Nrow - 2; |
---|
113 | k1 = Ncol - 2; |
---|
114 | } |
---|
115 | else { |
---|
116 | printf(" 8a) Starting indices? <i0> <j_0> <k0>\n>"); |
---|
117 | scanf("%d %d %d",&i0,&j_0,&k0); |
---|
118 | printf("%d %d %d\n",i0,j_0,k0); |
---|
119 | if (WriteParams) |
---|
120 | fprintf(paramfile, "%d %d %d\n",i0,j_0,k0); |
---|
121 | printf(" 8b) Final indices? <i1> <j_1> <k1>\n>"); |
---|
122 | scanf("%d %d %d",&i1,&j_1,&k1); |
---|
123 | printf("%d %d %d\n",i1,j_1,k1); |
---|
124 | if (WriteParams) |
---|
125 | fprintf(paramfile, "%d %d %d\n",i1,j_1,k1); |
---|
126 | } |
---|
127 | printf("9) Threshold value for contour surface?\n>"); |
---|
128 | scanf("%f",&threshold); |
---|
129 | printf("%f\n",threshold); |
---|
130 | if (WriteParams) { |
---|
131 | fprintf(paramfile, "%f\n",threshold); |
---|
132 | fclose(paramfile); |
---|
133 | } |
---|
134 | |
---|
135 | } /* GetInfo */ |
---|