pinn2amira.asv 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. % pinn2amira.m
  2. %
  3. % Ryan T Flynn 23 August 2007
  4. %
  5. % Reads in raw Pinnacle data and creates ROI mask files and an hx file that
  6. % is readable by Amira.
  7. %
  8. % The CT image and all of the ROIs are flipped onto a coordinate system in
  9. % which the position of each voxel index (i,j,k) are given by:
  10. %
  11. % x(i) = x0 + i*delx; (i=0,...,M-1)
  12. % y(j) = y0 + j*delx; (j=0,...,N-1)
  13. % z(k) = z0 + k*delx; (k=0,...,Q-1)
  14. %
  15. % As opposed to the Pinnacle coordinate system, which
  16. %
  17. % x(i) = x0 + i*delx; (i=0,...,M-1)
  18. % y(j) = y0 + (N-1-j)*dely; (j=0,...,N-1)
  19. % z(k) = z0 + k*delz; (k=0,...,Q-1)
  20. %%%%% Start of user-defined parameters %%%%%
  21. % locations of the Pinnacle files, getting rid of backslashes
  22. imageheaderfile = regexprep('C:\data_temp\steveTPS\plan\HN\ImageSet_0.header','\\','/');
  23. imagefile = regexprep('C:\Documents and Settings\Steve\My Documents\Research\treatmentPlanningSystem\patients\hn003\PinnacleData\ImageSet_0.img','\\','/');
  24. roifile = regexprep('C:\Documents and Settings\Steve\My Documents\Research\treatmentPlanningSystem\patients\hn003\PinnacleData\Plan_0\plan.roi','\\','/');
  25. amiraFolder = regexprep('C:\Documents and Settings\Steve\My Documents\Research\treatmentPlanningSystem\patients\hn003\AmiraData','\\','/'); % folder where Amira data will be saved
  26. amiraImgDataName = 'CT'; % name to give the image data in Amira
  27. amiraNetworkFileName = 'headAndNeck.hx'; % name of resulting Amira network file
  28. %%%%% End of user-defined parameters
  29. mkdir(amiraFolder); % create Amira data folder if it doesn't exist already
  30. start_ind = '(1,1,1)'; % this tag will be added to the ROIS so it is known where the start voxel is
  31. % extract geometric information from the header file
  32. fid_imageheaderfile = fopen(imageheaderfile,'r');
  33. tline = fgets(fid_imageheaderfile);
  34. while tline ~= -1
  35. % check the line for key words
  36. if length(findstr(tline,'x_dim')) & ~length(findstr(tline,'fname_index_start'))
  37. eval(tline); % run the line to get x_dim
  38. elseif length(findstr(tline,'y_dim'))
  39. eval(tline); % run the line to get y_dim
  40. elseif length(findstr(tline,'z_dim'))
  41. eval(tline); % run the line to get z_dim
  42. elseif length(findstr(tline,'x_pixdim'))
  43. eval(tline); % run the line to get x_pixdim
  44. elseif length(findstr(tline,'y_pixdim'))
  45. eval(tline); % run the line to get y_pixdim
  46. elseif length(findstr(tline,'z_pixdim'))
  47. eval(tline); % run the line to get z_pixdim
  48. elseif length(findstr(tline,'x_start'))
  49. eval(tline); % run the line to get x_start
  50. elseif length(findstr(tline,'y_start'))
  51. eval(tline); % run the line to get x_start
  52. elseif length(findstr(tline,'z_start'))
  53. eval(tline); % run the line to get x_start
  54. elseif length(findstr(tline,'bytes_pix'))
  55. eval(tline); % number of bytes per pixel
  56. end
  57. tline = fgets(fid_imageheaderfile);
  58. end
  59. fclose(fid_imageheaderfile);
  60. % calculate axes for the image
  61. x = x_start + [0:x_dim-1]*x_pixdim;
  62. y = y_start + [0:y_dim-1]*y_pixdim;
  63. z = z_start + [0:z_dim-1]*z_pixdim;
  64. if bytes_pix == 2
  65. dataType = 'short 1';
  66. end
  67. % create Amira script
  68. fidAmira = fopen([amiraFolder '/' amiraNetworkFileName],'w');
  69. fprintf(fidAmira,'# Amira Script\n');
  70. fprintf(fidAmira,'remove -all\n');
  71. fprintf(fidAmira,'remove ImageSet_0.img\n');
  72. fprintf(fidAmira,'\n');
  73. fprintf(fidAmira,'set hideNewModules 0\n');
  74. fprintf(fidAmira,['[ load -raw ' imagefile ' little xfastest ' dataType ' ' num2str(x_dim) ' ' num2str(y_dim) ' ' num2str(z_dim) ...
  75. ' ' num2str(x(1)) ' ' num2str(x(end)) ' ' num2str(y(1)) ' ' num2str(y(end)) ' ' num2str(z(1)) ' ' num2str(z(end)) ...
  76. '] setLabel ' amiraImgDataName '\n']);
  77. fprintf(fidAmira,[amiraImgDataName ' setIconPosition 20 10\n']);
  78. fprintf(fidAmira,[amiraImgDataName ' flip 1\n']); % flip the data along the y-axis
  79. fprintf(fidAmira,[amiraImgDataName ' fire\n']);
  80. fprintf(fidAmira,[amiraImgDataName ' setViewerMask 65535\n']);
  81. fprintf(fidAmira,'set hideNewModules 0\n');
  82. % done with image dataslice
  83. % read in ROIS
  84. fid_roifile = fopen(roifile,'r');
  85. roinames = {}; % start a cell array of the roi names
  86. % Flags to indicate which sets of angled brackets in the roi file tline is
  87. % inside.
  88. inroi = 0;
  89. incurve = 0;
  90. inpoints = 0;
  91. roi_num = 0; % current roi number
  92. tline = fgets(fid_roifile);
  93. while tline ~= -1
  94. % check the line for key words
  95. if length(findstr(tline,'roi={'))
  96. inroi = 1; % mark that we are now currently inside of an roi
  97. roi_num = roi_num + 1;
  98. % next line contains the roi name
  99. tline = fgets(fid_roifile);
  100. % pop off first token in line, the remainder of the line is the roi name
  101. [T,R] = strtok(tline);
  102. roi.name = strtrim(R);
  103. % pop off lines until we get to the number of curves in this roi
  104. while ~length(findstr(tline,'num_curve'))
  105. tline = fgets(fid_roifile);
  106. end
  107. % pop off the num_curve string
  108. [T,R] = strtok(tline);
  109. % pop off the equals sign
  110. [T,R] = strtok(R);
  111. % pop off the number of curves in this roi
  112. T = strtok(R,';');
  113. % save the number of curves to the roi stucture
  114. eval(['roi.num_curves = ' num2str(T) ';']);
  115. roi.curves = {}; % get the curves structure started
  116. % read in the next curve structure
  117. curve_num = 0; % number of the current curve
  118. while roi.num_curves > 0 & curve_num < roi.num_curves
  119. while ~length(findstr(tline,'curve={'));
  120. tline = fgets(fid_roifile);
  121. end
  122. curve_num = curve_num + 1;
  123. incurve = 1; % inside the curve structure now
  124. % find the number of points in this structure
  125. while ~length(findstr(tline,'num_points'))
  126. tline = fgets(fid_roifile);
  127. end
  128. % pop off the num_points string
  129. [T,R] = strtok(tline);
  130. % pop off the equals sign
  131. [T,R] = strtok(R);
  132. % pop off the number of points in this curve
  133. T = strtok(R,';');
  134. eval(['num_points = ' num2str(T) ';']);
  135. % find the points identifier
  136. while ~length(findstr(tline,'points={'))
  137. tline = fgets(fid_roifile);
  138. end
  139. inpoints = 1; % inside the points structure now
  140. % read in the block of points data
  141. block = fscanf(fid_roifile,'%g',[3 num_points]);
  142. % save the block of points to the roi stucture
  143. roi.curves{curve_num} = block';
  144. % read in the right parantheses for the points and curve
  145. % structures
  146. while ~length(findstr(tline,'};'))
  147. tline = fgets(fid_roifile);
  148. end
  149. inpoints = 0; % stepped outside of the points structure
  150. while ~length(findstr(tline,'};'))
  151. tline = fgets(fid_roifile);
  152. end
  153. incurve = 0; % stepped outside of the curves structure
  154. end
  155. % read until the roi closing bracket appears
  156. while ~length(findstr(tline,'};'))
  157. tline = fgets(fid_roifile);
  158. end
  159. inroi = 0; % we are now outside of the roi
  160. fprintf('read in %s roi\n',roi.name);
  161. ROIS{roi_num} = roi;
  162. end
  163. tline = fgets(fid_roifile);
  164. end
  165. fclose(fid_roifile);
  166. % ROIS have all been read-in, now just have to convert them to mask
  167. % matrices. We'll use roipoly for this.
  168. % Recall that we must use the Pinnacle coordinate system for this to work,
  169. % that is, (x,y,z) coordinates are given by:
  170. % x(i) = x_start + i*x_pixdim, i=0..x_dim-1
  171. % y(j) = y_start + (y_dim-1)*y_pixdim - j*y_pixdim, j=0..y_dim-1
  172. % z(k) = z_start + k*z_pixdim, k=0..z_dim-1
  173. %
  174. % Not all treatment planning systems use this type of coordinate system
  175. % definition, so it is very important to get them straight.
  176. %
  177. % To get around this we will manipulate the data such that we'll have:
  178. %
  179. % x(i) = x_start + i*x_pixdim, i=0..x_dim-1
  180. % y(j) = y_start + j*y_pixdim, j=0..y_dim-1
  181. % z(k) = z_start + k*z_pixdim, k=0..z_dim-1
  182. %
  183. % This can be done by a simple fliplr operation on all of the CT slices
  184. % define the coordinate system
  185. x = x_start:x_pixdim:x_start + (x_dim-1)*x_pixdim;
  186. y = y_start:y_pixdim:y_start + (y_dim-1)*y_pixdim;
  187. z = z_start:z_pixdim:z_start + (z_dim-1)*z_pixdim;
  188. Nroi = length(ROIS); % get number of ROIS
  189. % define the locations of the corners of the pixels in each slice
  190. xCorners = [x - x_pixdim/2 x(end) + x_pixdim/2];
  191. yCorners = [y - y_pixdim/2 y(end) + y_pixdim/2];
  192. % loop through all rois
  193. for roi_num=1:length(ROIS)
  194. % set up the roi mask
  195. roimask = zeros(x_dim,y_dim,z_dim,'int8');
  196. roimaskCorners = zeros(x_dim+1,y_dim+1,z_dim,'int8');
  197. % loop through all of the curves in the roi
  198. for curve_num=1:length(ROIS{roi_num}.curves)
  199. % make a copy of the curve for easy access
  200. current_curve = ROIS{roi_num}.curves{curve_num};
  201. % find the z-index (slice number) of this curve
  202. q = round((current_curve(1,3)-z_start)/z_pixdim) + 1;
  203. % put these index vectors into roipoly
  204. if q >= 1 & q <= z_dim
  205. roisliceCorners = double(roimaskCorners(:,:,q));
  206. % find which corners are inside the contour
  207. BWcorners = roipoly(yCorners,xCorners,roisliceCorners,current_curve(:,2),current_curve(:,1));
  208. % Mark all all pixels bordering corners that are inside the
  209. % contour
  210. roi_vox = sum(BWcorners(:)); % number of voxels in this ROI
  211. % find the voxel overlap between the current roi and BW:
  212. overlap_vox = sum(sum(BWcorners.*roisliceCorners));
  213. if overlap_vox == roi_vox
  214. roisliceCorners = roisliceCorners - BWcorners;
  215. else % if there is not perfect overlap, add the rois
  216. roisliceCorners = roisliceCorners + BWcorners;
  217. end
  218. roisliceCorners(roisliceCorners > 0) = 1; % make sure all mask values are unity
  219. roimaskCorners(:,:,q) = int8(roisliceCorners); % update the overall mask
  220. end
  221. end
  222. % save time be resampling only a subregion
  223. ind = find(roimaskCorners);
  224. [I,J,K] = ind2sub([x_dim+1 y_dim+1 z_dim],ind);
  225. indx = min(I)-3:max(I)+3;
  226. indy = min(J)-3:max(J)+3;
  227. indz = min(K)-3:max(K)+3;
  228. indx = indx(indx >= 1 & indx <= x_dim);
  229. indy = indy(indy >= 1 & indy <= y_dim);
  230. indz = indz(indz >= 1 & indz <= z_dim);
  231. % convert the corners to a 3-D roi mask
  232. roimask(indx,indy,indz) = ceil(gridResample3D(xCorners,yCorners,z,roimaskCorners,x(indx),y(indy),z(indz)));
  233. % save the indices of the roi mask
  234. ROIS{roi_num}.ind = int32(find(roimask ~= 0));
  235. ROIS{roi_num}.dim = [x_dim y_dim z_dim];
  236. ROIS{roi_num}.pixdim = [x_pixdim y_pixdim z_pixdim];
  237. ROIS{roi_num}.start = [x_start y_start z_start];
  238. ROIS{roi_num}.start_ind = start_ind;
  239. fprintf('Converted %s vectors to an roi mask.\n',ROIS{roi_num}.name);
  240. end
  241. %
  242. % % loop through all rois
  243. % for roi_num=1:Nroi
  244. % % set up the roi mask
  245. % roimask = zeros(x_dim,y_dim,z_dim,'int8');
  246. % % loop through all of the curves in the roi
  247. % for curve_num=1:length(ROIS{roi_num}.curves)
  248. % % make a copy of the curve for easy access
  249. % current_curve = ROIS{roi_num}.curves{curve_num};
  250. % % find the z-index (slice number) of this curve
  251. % q = round((current_curve(1,3)-z_start)/z_pixdim) + 1;
  252. % % convert the x and y vectors to indices
  253. % xind = (current_curve(:,1) - x_start)/x_pixdim + 1;
  254. % yind = (current_curve(:,2) - y_start)/y_pixdim + 1;
  255. % % put these index vectors into roipoly
  256. % if q >= 1 & q <= z_dim
  257. % roislice = double(roimask(:,:,q));
  258. % BW = roipoly(roislice,yind,xind);
  259. % roi_vox = sum(BW(:)); % number of voxels in this ROI
  260. % % find the voxel overlap between the current roi and BW:
  261. % overlap_vox = sum(sum(BW.*roislice));
  262. % if overlap_vox == roi_vox
  263. % roislice = roislice - BW;
  264. % else % if there is not perfect overlap, add the rois
  265. % roislice = roislice + BW;
  266. % end
  267. % roislice(roislice > 0) = 1; % make sure all mask values are unity
  268. % roimask(:,:,q) = int8(roislice);
  269. % end
  270. % end
  271. % % save the indices of the roi mask
  272. % ROIS{roi_num}.ind = int32(find(roimask ~= 0));
  273. % ROIS{roi_num}.dim = [x_dim y_dim z_dim];
  274. % ROIS{roi_num}.pixdim = [x_pixdim y_pixdim z_pixdim];
  275. % ROIS{roi_num}.start = [x_start y_start z_start];
  276. % ROIS{roi_num}.start_ind = start_ind;
  277. % fprintf('Converted %s vectors to an roi mask.\n',ROIS{roi_num}.name);
  278. % end
  279. % now that we have the ROIS in mask form, we can save them into an
  280. % Amira-readable format.
  281. % icon position vectors
  282. xIcon = [0:2]*200 + 50;
  283. yIcon = [0:1]*50;
  284. yShift = [0:Nroi]*60 + 400;
  285. % get the names of the rois
  286. roi_names = cell(1,Nroi);
  287. for k=1:Nroi
  288. roi_names{k} = ROIS{k}.name;
  289. end
  290. mask.start = [x(1) y(1) z(1)];
  291. mask.voxel_size = [x_pixdim y_pixdim z_pixdim];
  292. % create files for each mask region
  293. for k=1:Nroi
  294. mask_filename = [regexprep(roi_names{k},{'/',' '},'') '.am'];
  295. mask_filename = regexprep(mask_filename,' ',''); % remove spaces
  296. mask.data = zeros([x_dim y_dim z_dim],'int8');
  297. mask.data(ROIS{k}.ind) = 1; % fill in the mask
  298. geom2am(mask,[amiraFolder '/' mask_filename]); % save the structure to an Amira file
  299. fprintf(fidAmira,'set hideNewModules 0\n');
  300. fprintf(fidAmira,['[ load ${SCRIPTDIR}/' mask_filename ' ] setLabel ' mask_filename '\n']);
  301. fprintf(fidAmira,[mask_filename ' setIconPosition ' num2str(xIcon(1)) ' ' num2str(yIcon(1)+yShift(k)) '\n']);
  302. fprintf(fidAmira,[mask_filename ' fire\n']);
  303. fprintf(fidAmira,[mask_filename ' fire\n']);
  304. fprintf(fidAmira,[mask_filename ' setViewerMask 65535\n']);
  305. fprintf(fidAmira,'\n');
  306. % set up a CastField module for a LabelField for the mask
  307. fprintf(fidAmira,'set hideNewModules 0\n');
  308. castFieldName = ['CastField' num2str(k)];
  309. fprintf(fidAmira,['create HxCastField {' castFieldName '}\n']);
  310. fprintf(fidAmira,[castFieldName ' setIconPosition ' num2str(xIcon(2)) ' ' num2str(yIcon(1)+yShift(k)) '\n']);
  311. fprintf(fidAmira,[castFieldName ' data connect ' mask_filename '\n']);
  312. fprintf(fidAmira,[castFieldName ' colormap setDefaultColor 1 0.8 0.5\n']);
  313. fprintf(fidAmira,[castFieldName ' colormap setDefaultAlpha 0.500000\n']);
  314. fprintf(fidAmira,[castFieldName ' fire\n']);
  315. fprintf(fidAmira,[castFieldName ' outputType setValue 0 6\n']);
  316. fprintf(fidAmira,[castFieldName ' scaling setMinMax 0 -1.00000001384843e+024 1.00000001384843e+024\n']);
  317. fprintf(fidAmira,[castFieldName ' scaling setValue 0 1\n']);
  318. fprintf(fidAmira,[castFieldName ' scaling setMinMax 1 -1.00000001384843e+024 1.00000001384843e+024\n']);
  319. fprintf(fidAmira,[castFieldName ' scaling setValue 1 0\n']);
  320. fprintf(fidAmira,[castFieldName ' voxelGridOptions setValue 0 1\n']);
  321. fprintf(fidAmira,[castFieldName ' colorFieldOptions setValue 0 0\n']);
  322. fprintf(fidAmira,[castFieldName ' fire\n']);
  323. fprintf(fidAmira,[castFieldName ' setViewerMask 65535\n']);
  324. fprintf(fidAmira,[castFieldName ' deselect\n']);
  325. fprintf(fidAmira,'\n');
  326. % set up mask plotting routines
  327. mask_labelfield_name = regexprep(mask_filename,'am','Labelfield');
  328. fprintf(fidAmira,'set hideNewModules 0\n');
  329. fprintf(fidAmira,['[ {' castFieldName '} create\n']);
  330. fprintf(fidAmira,[' ] setLabel {' mask_labelfield_name '}\n']);
  331. fprintf(fidAmira,[mask_labelfield_name ' setIconPosition ' num2str(xIcon(1)) ' ' num2str(yIcon(2)+yShift(k)) '\n']);
  332. fprintf(fidAmira,[mask_labelfield_name ' master connect ' castFieldName '\n']);
  333. fprintf(fidAmira,[mask_labelfield_name ' fire\n']);
  334. fprintf(fidAmira,[mask_labelfield_name ' primary setValue 0 0\n']);
  335. fprintf(fidAmira,[mask_labelfield_name ' fire\n']);
  336. fprintf(fidAmira,[mask_labelfield_name ' setViewerMask 65535\n']);
  337. fprintf(fidAmira,'\n');
  338. surfaceGenName = ['SurfaceGen' num2str(k)];
  339. fprintf(fidAmira,'set hideNewModules 0\n');
  340. fprintf(fidAmira,['create HxGMC {' surfaceGenName '}\n']);
  341. fprintf(fidAmira,[surfaceGenName ' setIconPosition ' num2str(xIcon(3)) ' ' num2str(yIcon(1)+yShift(k)) '\n']);
  342. fprintf(fidAmira,[surfaceGenName ' data connect ' mask_labelfield_name '\n']);
  343. fprintf(fidAmira,[surfaceGenName ' fire\n']);
  344. fprintf(fidAmira,[surfaceGenName ' smoothing setValue 0 3\n']);
  345. fprintf(fidAmira,[surfaceGenName ' options setValue 0 1\n']);
  346. fprintf(fidAmira,[surfaceGenName ' options setValue 1 0\n']);
  347. fprintf(fidAmira,[surfaceGenName ' border setValue 0 1\n']);
  348. fprintf(fidAmira,[surfaceGenName ' border setValue 1 0\n']);
  349. fprintf(fidAmira,[surfaceGenName ' minEdgeLength setMinMax 0 0 0.800000011920929\n']);
  350. fprintf(fidAmira,[surfaceGenName ' minEdgeLength setValue 0 0\n']);
  351. fprintf(fidAmira,[surfaceGenName ' materialList setValue 0 0\n']);
  352. fprintf(fidAmira,[surfaceGenName ' fire\n']);
  353. fprintf(fidAmira,[surfaceGenName ' setViewerMask 65535\n']);
  354. fprintf(fidAmira,'\n');
  355. mask_surf_name = regexprep(mask_filename,'am','surf');
  356. fprintf(fidAmira,'set hideNewModules 0\n');
  357. fprintf(fidAmira,['[ {' surfaceGenName '} create {' mask_surf_name '}\n']);
  358. fprintf(fidAmira,[' ] setLabel {' mask_surf_name '}\n']);
  359. fprintf(fidAmira,[mask_surf_name ' setIconPosition ' num2str(xIcon(2)) ' ' num2str(yIcon(2)+yShift(k)) '\n']);
  360. fprintf(fidAmira,[mask_surf_name ' master connect ' surfaceGenName '\n']);
  361. fprintf(fidAmira,[mask_surf_name ' fire\n']);
  362. fprintf(fidAmira,[mask_surf_name ' LevelOfDetail setMinMax -1 -1\n']);
  363. fprintf(fidAmira,[mask_surf_name ' LevelOfDetail setButtons 1\n']);
  364. fprintf(fidAmira,[mask_surf_name ' LevelOfDetail setIncrement 1\n']);
  365. fprintf(fidAmira,[mask_surf_name ' LevelOfDetail setValue -1\n']);
  366. fprintf(fidAmira,[mask_surf_name ' LevelOfDetail setSubMinMax -1 -1\n']);
  367. fprintf(fidAmira,[mask_surf_name ' fire\n']);
  368. fprintf(fidAmira,[mask_surf_name ' setViewerMask 65535\n']);
  369. fprintf(fidAmira,[mask_surf_name ' deselect\n']);
  370. fprintf(fidAmira,'\n');
  371. fprintf(fidAmira,'set hideNewModules 0\n');
  372. fprintf(fidAmira,'\n');
  373. surfaceViewName = ['SurfaceView' num2str(k)];
  374. fprintf(fidAmira,'set hideNewModules 0\n');
  375. fprintf(fidAmira,['create HxDisplaySurface {' surfaceViewName '}\n']);
  376. fprintf(fidAmira,[surfaceViewName ' setIconPosition ' num2str(xIcon(3)) ' ' num2str(yIcon(2)+yShift(k)) '\n']);
  377. fprintf(fidAmira,[surfaceViewName ' data connect ' mask_surf_name '\n']);
  378. fprintf(fidAmira,[surfaceViewName ' colormap setDefaultColor 1 0.1 0.1\n']);
  379. fprintf(fidAmira,[surfaceViewName ' colormap setDefaultAlpha 0.500000\n']);
  380. fprintf(fidAmira,[surfaceViewName ' fire\n']);
  381. fprintf(fidAmira,[surfaceViewName ' drawStyle setValue 4\n']);
  382. fprintf(fidAmira,[surfaceViewName ' drawStyle setSpecularLighting 1\n']);
  383. fprintf(fidAmira,[surfaceViewName ' drawStyle setTexture 0\n']);
  384. fprintf(fidAmira,[surfaceViewName ' drawStyle setAlphaMode 3\n']);
  385. fprintf(fidAmira,[surfaceViewName ' drawStyle setNormalBinding 0\n']);
  386. fprintf(fidAmira,[surfaceViewName ' drawStyle setCullingMode 0\n']);
  387. fprintf(fidAmira,[surfaceViewName ' selectionMode setValue 0 0\n']);
  388. fprintf(fidAmira,[surfaceViewName ' Patch setMinMax 0 1\n']);
  389. fprintf(fidAmira,[surfaceViewName ' Patch setButtons 1\n']);
  390. fprintf(fidAmira,[surfaceViewName ' Patch setIncrement 1\n']);
  391. fprintf(fidAmira,[surfaceViewName ' Patch setValue 1\n']);
  392. fprintf(fidAmira,[surfaceViewName ' Patch setSubMinMax 0 1\n']);
  393. fprintf(fidAmira,[surfaceViewName ' BoundaryId setValue 0 -1\n']);
  394. fprintf(fidAmira,[surfaceViewName ' materials setValue 0 1\n']);
  395. fprintf(fidAmira,[surfaceViewName ' materials setValue 1 0\n']);
  396. fprintf(fidAmira,[surfaceViewName ' colorMode setValue 0\n']);
  397. fprintf(fidAmira,[surfaceViewName ' baseTrans setMinMax 0 1\n']);
  398. fprintf(fidAmira,[surfaceViewName ' baseTrans setButtons 0\n']);
  399. fprintf(fidAmira,[surfaceViewName ' baseTrans setIncrement 0.1\n']);
  400. fprintf(fidAmira,[surfaceViewName ' baseTrans setValue 0.53\n']);
  401. fprintf(fidAmira,[surfaceViewName ' baseTrans setSubMinMax 0 1\n']);
  402. fprintf(fidAmira,[surfaceViewName ' VRMode setValue 0 0\n']);
  403. fprintf(fidAmira,[surfaceViewName ' fire\n']);
  404. fprintf(fidAmira,[surfaceViewName ' hideBox 1\n']);
  405. fprintf(fidAmira,['{' surfaceViewName '} selectTriangles zab HIJMPLPPHPGAABDPBAADAACGHIICIN\n']);
  406. fprintf(fidAmira,[surfaceViewName ' fire\n']);
  407. fprintf(fidAmira,[surfaceViewName ' setViewerMask 65535\n']);
  408. fprintf(fidAmira,[surfaceViewName ' deselect\n']);
  409. fprintf(fidAmira,'\n');
  410. % remove unneeded junk
  411. fprintf(fidAmira,['remove ' mask_filename '\n']);
  412. fprintf(fidAmira,['remove ' surfaceGenName '\n']);
  413. end
  414. fclose(fidAmira);