Package dx :: Module isosurface_3D
[hide private]
[frames] | no frames]

Source Code for Module dx.isosurface_3D

   1  ############################################################################### 
   2  #                                                                             # 
   3  # Copyright (C) 2003-2006 Edward d'Auvergne                                   # 
   4  #                                                                             # 
   5  # This file is part of the program relax.                                     # 
   6  #                                                                             # 
   7  # relax is free software; you can redistribute it and/or modify               # 
   8  # it under the terms of the GNU General Public License as published by        # 
   9  # the Free Software Foundation; either version 2 of the License, or           # 
  10  # (at your option) any later version.                                         # 
  11  #                                                                             # 
  12  # relax is distributed in the hope that it will be useful,                    # 
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
  15  # GNU General Public License for more details.                                # 
  16  #                                                                             # 
  17  # You should have received a copy of the GNU General Public License           # 
  18  # along with relax; if not, write to the Free Software                        # 
  19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
  20  #                                                                             # 
  21  ############################################################################### 
  22   
  23   
  24  from Numeric import Float64, zeros 
  25   
  26  from base_map import Base_Map 
  27   
  28   
29 -class Iso3D(Base_Map):
30 - def __init__(self, relax):
31 """3D isosurface class.""" 32 33 self.relax = relax
34 35
36 - def config_text(self):
37 """Function for creating the text of the OpenDX program configuration file.""" 38 39 # Generate the text. 40 text = """// 41 // 42 // time: """ + self.date + """ 43 // 44 // version: 3.2.0 (format), 4.3.2 (DX) 45 // 46 // 47 // panel[0]: position = (0.0164,0.0000), size = 0.2521x0.1933, startup = 1, devstyle = 1 48 // title: value = Control Panel 49 // 50 // workspace: width = 251, height = 142 51 // layout: snap = 0, width = 50, height = 50, align = NN 52 // 53 // interactor Selector[1]: num_components = 1, value = 1 54 // selections: maximum = 2, current = 0 55 // option[0]: name = "Colour", value = 1 56 // option[1]: name = "Grey", value = 2 57 // instance: panel = 0, x = 81, y = 6, style = Scrolled List, vertical = 1, size = 170x136 58 // label: value = Colour Selector 59 // 60 // node Image[3]: 61 // title: value = Surface 62 // depth: value = 24 63 // window: position = (0.0000,0.0400), size = 0.9929x0.9276 64 """ 65 66 # Return the text. 67 return text
68 69
70 - def map_text(self, map_file):
71 """Function for creating the text of a 3D map.""" 72 73 # Initialise. 74 values = zeros(3, Float64) 75 percent = 0.0 76 percent_inc = 100.0 / (self.inc + 1.0)**(self.n - 1.0) 77 print "%-10s%8.3f%-1s" % ("Progress:", percent, "%") 78 79 # Fix the diffusion tensor. 80 unfix = 0 81 if self.relax.data.diff.has_key(self.run) and not self.relax.data.diff[self.run].fixed: 82 self.relax.data.diff[self.run].fixed = 1 83 unfix = 1 84 85 # Initial value of the first parameter. 86 values[0] = self.bounds[0, 0] 87 88 # Loop over the first parameter. 89 for i in xrange((self.inc + 1)): 90 # Initial value of the second parameter. 91 values[1] = self.bounds[1, 0] 92 93 # Loop over the second parameter. 94 for j in xrange((self.inc + 1)): 95 # Initial value of the third parameter. 96 values[2] = self.bounds[2, 0] 97 98 # Loop over the third parameter. 99 for k in xrange((self.inc + 1)): 100 # Set the parameter values. 101 self.relax.generic.value.set(run=self.run, value=values, param=self.params, res_num=self.res_num, force=1) 102 103 # Calculate the function values. 104 self.calculate(run=self.run, res_num=self.res_num, print_flag=0) 105 106 # Get the minimisation statistics for the model. 107 k, n, chi2 = self.model_stats(run=self.run, instance=self.index) 108 109 # Set maximum value to 1e20 to stop the OpenDX server connection from breaking. 110 if chi2 > 1e20: 111 map_file.write("%30f\n" % 1e20) 112 else: 113 map_file.write("%30f\n" % chi2) 114 115 # Increment the value of the third parameter. 116 values[2] = values[2] + self.step_size[2] 117 118 # Progress incrementation and print out. 119 percent = percent + percent_inc 120 print "%-10s%8.3f%-8s%-8g" % ("Progress:", percent, "%, " + `values` + ", f(x): ", chi2) 121 122 # Increment the value of the second parameter. 123 values[1] = values[1] + self.step_size[1] 124 125 # Increment the value of the first parameter. 126 values[0] = values[0] + self.step_size[0] 127 128 # Unfix the diffusion tensor. 129 if unfix: 130 self.relax.data.diff[self.run].fixed = 0
131 132
133 - def general_text(self):
134 """Function for creating the text of the OpenDX .general file for a 3D map.""" 135 136 # Generate the text. 137 text = "" 138 text = text + "file = " + self.file + "\n" 139 text = text + "grid = " + `(self.inc + 1)` + " x " + `(self.inc + 1)` + " x " + `(self.inc + 1)` + "\n" 140 text = text + "format = ascii\n" 141 text = text + "interleaving = field\n" 142 text = text + "majority = row\n" 143 text = text + "field = data\n" 144 text = text + "structure = scalar\n" 145 text = text + "type = float\n" 146 text = text + "dependency = positions\n" 147 text = text + "positions = regular, regular, regular, 0, 1, 0, 1, 0, 1\n\n" 148 text = text + "end\n" 149 150 # Return the text. 151 return text
152 153
154 - def point_text(self):
155 """Function for creating the text of the .general file for the point.""" 156 157 # Generate the import text. 158 text = "" 159 text = text + "file = " + self.point_file + "\n" 160 text = text + "points = 1\n" 161 text = text + "format = ascii\n" 162 text = text + "interleaving = field\n" 163 text = text + "field = locations, field0\n" 164 text = text + "structure = 3-vector, scalar\n" 165 text = text + "type = float, float\n\n" 166 text = text + "end\n" 167 168 # Return the text. 169 return text
170 171
172 - def program_text(self):
173 """Function for creating the text of the OpenDX program for a 3D map.""" 174 175 # Image setup. 176 image_array1 = "[" + `0.6 * (self.inc + 1.0)` + " " + `0.3 * (self.inc + 1.0)` + " " + `0.6 * (self.inc + 1.0)` + "]" 177 image_array2 = "[" + `0.6 * (self.inc + 1.0)` + " " + `0.3 * (self.inc + 1.0)` + " " + `6.0 * (self.inc + 1.0)` + "]" 178 image_val = `3.0 * (self.inc + 1.0)` 179 180 181 # Generate the text of the program. 182 ################################### 183 184 text = """// 185 // time: """ + self.date + """ 186 // 187 // version: 3.2.0 (format), 4.3.2 (DX) 188 // 189 // 190 // MODULE main""" 191 192 # Include the sphere. 193 if self.num_points == 1: 194 text = text + """ 195 // page assignment: Colour Space order=3, windowed=0, showing=0 196 // page assignment: ColourScene order=5, windowed=0, showing=0 197 // page assignment: Glyph order=2, windowed=0, showing=0 198 // page assignment: Grey Space order=4, windowed=0, showing=0 199 // page assignment: GreyScene order=6, windowed=0, showing=0 200 // page assignment: Image order=7, windowed=0, showing=0 201 // page assignment: Isosurfaces order=1, windowed=0, showing=1""" 202 # No sphere. 203 else: 204 text = text + """ 205 // page assignment: Colour Space order=4, windowed=0, showing=0 206 // page assignment: ColourScene order=6, windowed=0, showing=0 207 // page assignment: Grey Space order=5, windowed=0, showing=0 208 // page assignment: GreyScene order=7, windowed=0, showing=0 209 // page assignment: Image order=8, windowed=0, showing=0 210 // page assignment: Isosurfaces order=2, windowed=0, showing=1""" 211 212 # Common code. 213 text = text + """ 214 // workspace: width = 474, height = 354 215 // layout: snap = 0, width = 50, height = 50, align = NN 216 // 217 macro main( 218 ) -> ( 219 ) { 220 // """ 221 222 # Include the sphere. 223 if self.num_points == 1: 224 text = text + """ 225 // node Import[4]: x = 177, y = 62, inputs = 6, label = """ + self.point_file + """ 226 // input[1]: defaulting = 0, visible = 1, type = 32, value = \"""" + self.point_file + """.general" 227 // input[3]: defaulting = 1, visible = 1, type = 32, value = "general" 228 // page group: Glyph 229 // 230 main_Import_4_out_1 = 231 Import( 232 main_Import_4_in_1, 233 main_Import_4_in_2, 234 main_Import_4_in_3, 235 main_Import_4_in_4, 236 main_Import_4_in_5, 237 main_Import_4_in_6 238 ) [instance: 4, cache: 1]; 239 // 240 // node Glyph[2]: x = 201, y = 182, inputs = 7, label = Glyph 241 // input[2]: defaulting = 0, visible = 1, type = 32, value = "sphere" 242 // input[3]: defaulting = 1, visible = 1, type = 5, value = 10.0 243 // input[4]: defaulting = 0, visible = 1, type = 5, value = """ + self.sphere_size + """ 244 // input[5]: defaulting = 0, visible = 1, type = 5, value = 0.0 245 // page group: Glyph 246 // 247 main_Glyph_2_out_1 = 248 Glyph( 249 main_Import_4_out_1, 250 main_Glyph_2_in_2, 251 main_Glyph_2_in_3, 252 main_Glyph_2_in_4, 253 main_Glyph_2_in_5, 254 main_Glyph_2_in_6, 255 main_Glyph_2_in_7 256 ) [instance: 2, cache: 1]; 257 // 258 // node Color[10]: x = 357, y = 278, inputs = 5, label = Color 259 // input[2]: defaulting = 0, visible = 1, type = 8, value = [0 0 0] 260 // input[3]: defaulting = 0, visible = 1, type = 5, value = 1.0 261 // page group: Glyph 262 // 263 main_Color_10_out_1 = 264 Color( 265 main_Glyph_2_out_1, 266 main_Color_10_in_2, 267 main_Color_10_in_3, 268 main_Color_10_in_4, 269 main_Color_10_in_5 270 ) [instance: 10, cache: 1]; 271 // 272 // node Transmitter[1]: x = 352, y = 386, inputs = 1, label = GreySphere 273 // page group: Glyph 274 // 275 GreySphere = main_Color_10_out_1; 276 // 277 // node Receiver[2]: x = 190, y = 350, inputs = 1, label = GreySphere 278 // page group: Grey Space 279 // 280 main_Receiver_2_out_1[cache: 0] = GreySphere;""" 281 282 # Common code. 283 text = text + """ 284 // 285 // node Import[3]: x = 225, y = 84, inputs = 6, label = """ + self.file + """ 286 // input[1]: defaulting = 0, visible = 1, type = 32, value = \"""" + self.file + """.general" 287 // input[3]: defaulting = 1, visible = 1, type = 32, value = "general" 288 // page group: Isosurfaces 289 // 290 main_Import_3_out_1 = 291 Import( 292 main_Import_3_in_1, 293 main_Import_3_in_2, 294 main_Import_3_in_3, 295 main_Import_3_in_4, 296 main_Import_3_in_5, 297 main_Import_3_in_6 298 ) [instance: 3, cache: 1]; 299 // 300 // node Isosurface[5]: x = 102, y = 191, inputs = 6, label = Outer Isosurface 301 // input[2]: defaulting = 0, visible = 1, type = 5, value = 500.0 302 // page group: Isosurfaces 303 // 304 main_Isosurface_5_out_1 = 305 Isosurface( 306 main_Import_3_out_1, 307 main_Isosurface_5_in_2, 308 main_Isosurface_5_in_3, 309 main_Isosurface_5_in_4, 310 main_Isosurface_5_in_5, 311 main_Isosurface_5_in_6 312 ) [instance: 5, cache: 1]; 313 // 314 // node Transmitter[7]: x = 110, y = 292, inputs = 1, label = Surface4 315 // page group: Isosurfaces 316 // 317 Surface4 = main_Isosurface_5_out_1; 318 // 319 // node Receiver[14]: x = 123, y = 51, inputs = 1, label = Surface4 320 // page group: Grey Space 321 // 322 main_Receiver_14_out_1[cache: 0] = Surface4; 323 // 324 // node Color[6]: x = 142, y = 145, inputs = 5, label = Color 325 // input[2]: defaulting = 0, visible = 1, type = 8, value = [0 0 0] 326 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.2 327 // page group: Grey Space 328 // 329 main_Color_6_out_1 = 330 Color( 331 main_Receiver_14_out_1, 332 main_Color_6_in_2, 333 main_Color_6_in_3, 334 main_Color_6_in_4, 335 main_Color_6_in_5 336 ) [instance: 6, cache: 1]; 337 // 338 // node Isosurface[6]: x = 200, y = 191, inputs = 6, label = Middle Isosurface 339 // input[2]: defaulting = 0, visible = 1, type = 5, value = 100.0 340 // page group: Isosurfaces 341 // 342 main_Isosurface_6_out_1 = 343 Isosurface( 344 main_Import_3_out_1, 345 main_Isosurface_6_in_2, 346 main_Isosurface_6_in_3, 347 main_Isosurface_6_in_4, 348 main_Isosurface_6_in_5, 349 main_Isosurface_6_in_6 350 ) [instance: 6, cache: 1]; 351 // 352 // node Transmitter[8]: x = 208, y = 292, inputs = 1, label = Surface3 353 // page group: Isosurfaces 354 // 355 Surface3 = main_Isosurface_6_out_1; 356 // 357 // node Receiver[13]: x = 227, y = 51, inputs = 1, label = Surface3 358 // page group: Grey Space 359 // 360 main_Receiver_13_out_1[cache: 0] = Surface3; 361 // 362 // node Color[7]: x = 246, y = 145, inputs = 5, label = Color 363 // input[2]: defaulting = 0, visible = 1, type = 8, value = [0.2 0.2 0.2] 364 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.4 365 // page group: Grey Space 366 // 367 main_Color_7_out_1 = 368 Color( 369 main_Receiver_13_out_1, 370 main_Color_7_in_2, 371 main_Color_7_in_3, 372 main_Color_7_in_4, 373 main_Color_7_in_5 374 ) [instance: 7, cache: 1]; 375 // 376 // node Collect[5]: x = 203, y = 236, inputs = 2, label = Collect 377 // page group: Grey Space 378 // 379 main_Collect_5_out_1 = 380 Collect( 381 main_Color_6_out_1, 382 main_Color_7_out_1 383 ) [instance: 5, cache: 1]; 384 // 385 // node Isosurface[7]: x = 298, y = 191, inputs = 6, label = Inner Isosurface 386 // input[2]: defaulting = 0, visible = 1, type = 5, value = 20.0 387 // page group: Isosurfaces 388 // 389 main_Isosurface_7_out_1 = 390 Isosurface( 391 main_Import_3_out_1, 392 main_Isosurface_7_in_2, 393 main_Isosurface_7_in_3, 394 main_Isosurface_7_in_4, 395 main_Isosurface_7_in_5, 396 main_Isosurface_7_in_6 397 ) [instance: 7, cache: 1]; 398 // 399 // node Transmitter[9]: x = 306, y = 292, inputs = 1, label = Surface2 400 // page group: Isosurfaces 401 // 402 Surface2 = main_Isosurface_7_out_1; 403 // 404 // node Receiver[12]: x = 331, y = 51, inputs = 1, label = Surface2 405 // page group: Grey Space 406 // 407 main_Receiver_12_out_1[cache: 0] = Surface2; 408 // 409 // node Color[8]: x = 350, y = 145, inputs = 5, label = Color 410 // input[2]: defaulting = 0, visible = 1, type = 8, value = [0.5 0.5 0.5] 411 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.5 412 // page group: Grey Space 413 // 414 main_Color_8_out_1 = 415 Color( 416 main_Receiver_12_out_1, 417 main_Color_8_in_2, 418 main_Color_8_in_3, 419 main_Color_8_in_4, 420 main_Color_8_in_5 421 ) [instance: 8, cache: 1]; 422 // 423 // node Isosurface[8]: x = 396, y = 191, inputs = 6, label = Innermost Isosurface 424 // input[2]: defaulting = 0, visible = 1, type = 5, value = 7.0 425 // page group: Isosurfaces 426 // 427 main_Isosurface_8_out_1 = 428 Isosurface( 429 main_Import_3_out_1, 430 main_Isosurface_8_in_2, 431 main_Isosurface_8_in_3, 432 main_Isosurface_8_in_4, 433 main_Isosurface_8_in_5, 434 main_Isosurface_8_in_6 435 ) [instance: 8, cache: 1]; 436 // 437 // node Transmitter[10]: x = 404, y = 292, inputs = 1, label = Surface1 438 // page group: Isosurfaces 439 // 440 Surface1 = main_Isosurface_8_out_1; 441 // 442 // node Receiver[11]: x = 434, y = 51, inputs = 1, label = Surface1 443 // page group: Grey Space 444 // 445 main_Receiver_11_out_1[cache: 0] = Surface1; 446 // 447 // node Color[9]: x = 453, y = 145, inputs = 5, label = Color 448 // input[2]: defaulting = 0, visible = 1, type = 32, value = "white" 449 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.7 450 // page group: Grey Space 451 // 452 main_Color_9_out_1 = 453 Color( 454 main_Receiver_11_out_1, 455 main_Color_9_in_2, 456 main_Color_9_in_3, 457 main_Color_9_in_4, 458 main_Color_9_in_5 459 ) [instance: 9, cache: 1]; 460 // 461 // node Collect[6]: x = 409, y = 236, inputs = 2, label = Collect 462 // page group: Grey Space 463 // 464 main_Collect_6_out_1 = 465 Collect( 466 main_Color_8_out_1, 467 main_Color_9_out_1 468 ) [instance: 6, cache: 1]; 469 // 470 // node Collect[7]: x = 307, y = 327, inputs = 2, label = Collect 471 // page group: Grey Space 472 // 473 main_Collect_7_out_1 = 474 Collect( 475 main_Collect_5_out_1, 476 main_Collect_6_out_1 477 ) [instance: 7, cache: 1]; 478 // """ 479 480 # Include the sphere. 481 if self.num_points == 1: 482 text = text + """ 483 // node Collect[8]: x = 293, y = 431, inputs = 2, label = Collect 484 // page group: Grey Space 485 // 486 main_Collect_8_out_1 = 487 Collect( 488 main_Receiver_2_out_1, 489 main_Collect_7_out_1 490 ) [instance: 8, cache: 1]; 491 // 492 // node Transmitter[4]: x = 282, y = 517, inputs = 1, label = GreySpace""" 493 494 # No sphere. 495 else: 496 text = text + """ 497 // node Transmitter[4]: x = 296, y = 439, inputs = 1, label = GreySpace""" 498 499 # Common code. 500 text = text + """ 501 // page group: Grey Space 502 // """ 503 504 # Include the sphere. 505 if self.num_points == 1: 506 text = text + """ 507 GreySpace = main_Collect_8_out_1;""" 508 509 # No sphere. 510 else: 511 text = text + """ 512 GreySpace = main_Collect_7_out_1;""" 513 514 # Common code. 515 text = text + """ 516 // 517 // node Receiver[3]: x = 137, y = 57, inputs = 1, label = GreySpace 518 // page group: GreyScene 519 // 520 main_Receiver_3_out_1[cache: 0] = GreySpace; 521 // 522 // node Scale[3]: x = 163, y = 159, inputs = 2, label = Scale 523 // input[2]: defaulting = 0, visible = 1, type = 8, value = [1 1 1] 524 // page group: GreyScene 525 // 526 main_Scale_3_out_1 = 527 Scale( 528 main_Receiver_3_out_1, 529 main_Scale_3_in_2 530 ) [instance: 3, cache: 1]; 531 // 532 // node AutoCamera[2]: x = 273, y = 264, inputs = 9, label = AutoCamera 533 // input[2]: defaulting = 0, visible = 1, type = 8, value = [1 -1 1] 534 // input[3]: defaulting = 1, visible = 1, type = 5, value = 500.0 535 // input[4]: defaulting = 0, visible = 0, type = 1, value = 640 536 // input[5]: defaulting = 0, visible = 0, type = 5, value = .75 537 // input[6]: defaulting = 0, visible = 0, type = 8, value = [-1 1 0 ] 538 // input[7]: defaulting = 0, visible = 0, type = 3, value = 0 539 // input[8]: defaulting = 0, visible = 0, type = 5, value = 30.0 540 // input[9]: defaulting = 0, visible = 1, type = 32, value = "white" 541 // page group: GreyScene 542 // 543 main_AutoCamera_2_out_1 = 544 AutoCamera( 545 main_Scale_3_out_1, 546 main_AutoCamera_2_in_2, 547 main_AutoCamera_2_in_3, 548 main_AutoCamera_2_in_4, 549 main_AutoCamera_2_in_5, 550 main_AutoCamera_2_in_6, 551 main_AutoCamera_2_in_7, 552 main_AutoCamera_2_in_8, 553 main_AutoCamera_2_in_9 554 ) [instance: 2, cache: 1]; 555 // 556 // node AutoAxes[2]: x = 175, y = 379, inputs = 19, label = AutoAxes 557 // input[3]: defaulting = 0, visible = 1, type = 16777248, value = """ + self.labels + """ 558 // input[4]: defaulting = 0, visible = 0, type = 1, value = 30 559 // input[5]: defaulting = 0, visible = 1, type = 16777224, value = """ + self.corners + """ 560 // input[6]: defaulting = 0, visible = 1, type = 3, value = 1 561 // input[7]: defaulting = 1, visible = 0, type = 3, value = 1 562 // input[9]: defaulting = 0, visible = 1, type = 3, value = 1 563 // input[10]: defaulting = 0, visible = 1, type = 16777224, value = {[1 1 1] [0.1 0.1 0.1] [0 0 0] [0 0 0]} 564 // input[11]: defaulting = 0, visible = 1, type = 16777248, value = {"background" "grid" "labels" "ticks"} 565 // input[12]: defaulting = 1, visible = 0, type = 5, value = 0.4 566 // input[13]: defaulting = 0, visible = 0, type = 32, value = "area" 567 // input[14]: defaulting = 0, visible = 1, type = 16777221, value = """ + self.tick_locations[0] + """ 568 // input[15]: defaulting = 0, visible = 1, type = 16777221, value = """ + self.tick_locations[1] + """ 569 // input[16]: defaulting = 0, visible = 1, type = 16777221, value = """ + self.tick_locations[2] + """ 570 // input[17]: defaulting = 0, visible = 1, type = 16777248, value = """ + self.tick_values[0] + """ 571 // input[18]: defaulting = 0, visible = 1, type = 16777248, value = """ + self.tick_values[1] + """ 572 // input[19]: defaulting = 0, visible = 1, type = 16777248, value = """ + self.tick_values[2] + """ 573 // page group: GreyScene 574 // 575 main_AutoAxes_2_out_1 = 576 AutoAxes( 577 main_Scale_3_out_1, 578 main_AutoCamera_2_out_1, 579 main_AutoAxes_2_in_3, 580 main_AutoAxes_2_in_4, 581 main_AutoAxes_2_in_5, 582 main_AutoAxes_2_in_6, 583 main_AutoAxes_2_in_7, 584 main_AutoAxes_2_in_8, 585 main_AutoAxes_2_in_9, 586 main_AutoAxes_2_in_10, 587 main_AutoAxes_2_in_11, 588 main_AutoAxes_2_in_12, 589 main_AutoAxes_2_in_13, 590 main_AutoAxes_2_in_14, 591 main_AutoAxes_2_in_15, 592 main_AutoAxes_2_in_16, 593 main_AutoAxes_2_in_17, 594 main_AutoAxes_2_in_18, 595 main_AutoAxes_2_in_19 596 ) [instance: 2, cache: 1]; 597 // """ 598 599 # Include the sphere. 600 if self.num_points == 1: 601 text = text + """ 602 // node Color[11]: x = 133, y = 278, inputs = 5, label = Color 603 // input[2]: defaulting = 0, visible = 1, type = 8, value = [1 0 0] 604 // input[3]: defaulting = 0, visible = 1, type = 5, value = 1.0 605 // page group: Glyph 606 // 607 main_Color_11_out_1 = 608 Color( 609 main_Glyph_2_out_1, 610 main_Color_11_in_2, 611 main_Color_11_in_3, 612 main_Color_11_in_4, 613 main_Color_11_in_5 614 ) [instance: 11, cache: 1]; 615 // 616 // node Transmitter[2]: x = 122, y = 386, inputs = 1, label = ColourSphere 617 // page group: Glyph 618 // 619 ColourSphere = main_Color_11_out_1; 620 // 621 // node Receiver[1]: x = 179, y = 349, inputs = 1, label = ColourSphere 622 // page group: Colour Space 623 // 624 main_Receiver_1_out_1[cache: 0] = ColourSphere;""" 625 626 # Common code. 627 text = text + """ 628 // 629 // node Receiver[10]: x = 123, y = 51, inputs = 1, label = Surface4 630 // page group: Colour Space 631 // 632 main_Receiver_10_out_1[cache: 0] = Surface4; 633 // 634 // node Color[12]: x = 142, y = 145, inputs = 5, label = Color 635 // input[2]: defaulting = 0, visible = 1, type = 8, value = [0 0 0.2] 636 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.3 637 // input[4]: defaulting = 1, visible = 0, type = 32, value = NULL 638 // input[5]: defaulting = 1, visible = 0, type = 3, value = NULL 639 // page group: Colour Space 640 // 641 main_Color_12_out_1 = 642 Color( 643 main_Receiver_10_out_1, 644 main_Color_12_in_2, 645 main_Color_12_in_3, 646 main_Color_12_in_4, 647 main_Color_12_in_5 648 ) [instance: 12, cache: 1]; 649 // 650 // node Receiver[9]: x = 227, y = 51, inputs = 1, label = Surface3 651 // page group: Colour Space 652 // 653 main_Receiver_9_out_1[cache: 0] = Surface3; 654 // 655 // node Color[13]: x = 246, y = 145, inputs = 5, label = Color 656 // input[2]: defaulting = 0, visible = 1, type = 32, value = "blue" 657 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.3 658 // page group: Colour Space 659 // 660 main_Color_13_out_1 = 661 Color( 662 main_Receiver_9_out_1, 663 main_Color_13_in_2, 664 main_Color_13_in_3, 665 main_Color_13_in_4, 666 main_Color_13_in_5 667 ) [instance: 13, cache: 1]; 668 // 669 // node Collect[9]: x = 203, y = 236, inputs = 2, label = Collect 670 // page group: Colour Space 671 // 672 main_Collect_9_out_1 = 673 Collect( 674 main_Color_12_out_1, 675 main_Color_13_out_1 676 ) [instance: 9, cache: 1]; 677 // 678 // node Receiver[8]: x = 331, y = 51, inputs = 1, label = Surface2 679 // page group: Colour Space 680 // 681 main_Receiver_8_out_1[cache: 0] = Surface2; 682 // 683 // node Color[14]: x = 350, y = 145, inputs = 5, label = Color 684 // input[2]: defaulting = 0, visible = 1, type = 8, value = [0.5 0.5 1] 685 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.2 686 // page group: Colour Space 687 // 688 main_Color_14_out_1 = 689 Color( 690 main_Receiver_8_out_1, 691 main_Color_14_in_2, 692 main_Color_14_in_3, 693 main_Color_14_in_4, 694 main_Color_14_in_5 695 ) [instance: 14, cache: 1]; 696 // 697 // node Receiver[7]: x = 434, y = 51, inputs = 1, label = Surface1 698 // page group: Colour Space 699 // 700 main_Receiver_7_out_1[cache: 0] = Surface1; 701 // 702 // node Color[15]: x = 453, y = 145, inputs = 5, label = Color 703 // input[2]: defaulting = 0, visible = 1, type = 32, value = "white" 704 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.55 705 // input[4]: defaulting = 1, visible = 0, type = 32, value = "positions" 706 // page group: Colour Space 707 // 708 main_Color_15_out_1 = 709 Color( 710 main_Receiver_7_out_1, 711 main_Color_15_in_2, 712 main_Color_15_in_3, 713 main_Color_15_in_4, 714 main_Color_15_in_5 715 ) [instance: 15, cache: 1]; 716 // 717 // node Collect[10]: x = 409, y = 236, inputs = 2, label = Collect 718 // page group: Colour Space 719 // 720 main_Collect_10_out_1 = 721 Collect( 722 main_Color_14_out_1, 723 main_Color_15_out_1 724 ) [instance: 10, cache: 1]; 725 // 726 // node Collect[11]: x = 307, y = 327, inputs = 2, label = Collect 727 // page group: Colour Space 728 // 729 main_Collect_11_out_1 = 730 Collect( 731 main_Collect_9_out_1, 732 main_Collect_10_out_1 733 ) [instance: 11, cache: 1]; 734 // """ 735 736 # Include the sphere. 737 if self.num_points == 1: 738 text = text + """ 739 // node Collect[12]: x = 293, y = 431, inputs = 2, label = Collect 740 // page group: Colour Space 741 // 742 main_Collect_12_out_1 = 743 Collect( 744 main_Receiver_1_out_1, 745 main_Collect_11_out_1 746 ) [instance: 12, cache: 1]; 747 // 748 // node Transmitter[3]: x = 276, y = 517, inputs = 1, label = ColourSpace""" 749 750 # No sphere. 751 else: 752 text = text + """ 753 // node Transmitter[3]: x = 290, y = 440, inputs = 1, label = ColourSpace""" 754 755 # Common code. 756 text = text + """ 757 // page group: Colour Space 758 // """ 759 760 # Include the sphere. 761 if self.num_points == 1: 762 text = text + """ 763 ColourSpace = main_Collect_12_out_1;""" 764 765 # No sphere. 766 else: 767 text = text + """ 768 ColourSpace = main_Collect_11_out_1;""" 769 770 # Common code. 771 text = text + """ 772 // 773 // node Receiver[4]: x = 131, y = 58, inputs = 1, label = ColourSpace 774 // page group: ColourScene 775 // 776 main_Receiver_4_out_1[cache: 0] = ColourSpace; 777 // 778 // node Scale[5]: x = 163, y = 159, inputs = 2, label = Scale 779 // input[2]: defaulting = 0, visible = 1, type = 8, value = [1 1 1] 780 // page group: ColourScene 781 // 782 main_Scale_5_out_1 = 783 Scale( 784 main_Receiver_4_out_1, 785 main_Scale_5_in_2 786 ) [instance: 5, cache: 1]; 787 // 788 // node AutoCamera[4]: x = 273, y = 264, inputs = 9, label = AutoCamera 789 // input[2]: defaulting = 0, visible = 1, type = 8, value = [1 -1 1] 790 // input[3]: defaulting = 1, visible = 1, type = 5, value = 500.0 791 // input[5]: defaulting = 0, visible = 0, type = 5, value = .75 792 // input[6]: defaulting = 0, visible = 0, type = 8, value = [-1 1 0 ] 793 // input[7]: defaulting = 0, visible = 0, type = 3, value = 0 794 // input[8]: defaulting = 0, visible = 0, type = 5, value = 30.0 795 // input[9]: defaulting = 0, visible = 1, type = 32, value = "black" 796 // page group: ColourScene 797 // 798 main_AutoCamera_4_out_1 = 799 AutoCamera( 800 main_Scale_5_out_1, 801 main_AutoCamera_4_in_2, 802 main_AutoCamera_4_in_3, 803 main_AutoCamera_4_in_4, 804 main_AutoCamera_4_in_5, 805 main_AutoCamera_4_in_6, 806 main_AutoCamera_4_in_7, 807 main_AutoCamera_4_in_8, 808 main_AutoCamera_4_in_9 809 ) [instance: 4, cache: 1]; 810 // 811 // node AutoAxes[4]: x = 175, y = 379, inputs = 19, label = AutoAxes 812 // input[3]: defaulting = 0, visible = 1, type = 16777248, value = """ + self.labels + """ 813 // input[4]: defaulting = 0, visible = 0, type = 1, value = 30 814 // input[5]: defaulting = 0, visible = 1, type = 16777224, value = """ + self.corners + """ 815 // input[6]: defaulting = 0, visible = 1, type = 3, value = 1 816 // input[7]: defaulting = 1, visible = 0, type = 3, value = 1 817 // input[9]: defaulting = 0, visible = 1, type = 3, value = 1 818 // input[10]: defaulting = 0, visible = 1, type = 16777224, value = {[0.05 0.05 0.05] [0.3 0.3 0.3] [1 1 1] [1 1 0]} 819 // input[11]: defaulting = 0, visible = 1, type = 16777248, value = {"background" "grid" "labels" "ticks"} 820 // input[12]: defaulting = 1, visible = 0, type = 5, value = 0.4 821 // input[13]: defaulting = 0, visible = 0, type = 32, value = "area" 822 // input[14]: defaulting = 0, visible = 1, type = 16777221, value = """ + self.tick_locations[0] + """ 823 // input[15]: defaulting = 0, visible = 1, type = 16777221, value = """ + self.tick_locations[1] + """ 824 // input[16]: defaulting = 0, visible = 1, type = 16777221, value = """ + self.tick_locations[2] + """ 825 // input[17]: defaulting = 0, visible = 1, type = 16777248, value = """ + self.tick_values[0] + """ 826 // input[18]: defaulting = 0, visible = 1, type = 16777248, value = """ + self.tick_values[1] + """ 827 // input[19]: defaulting = 0, visible = 1, type = 16777248, value = """ + self.tick_values[2] + """ 828 // page group: ColourScene 829 // 830 main_AutoAxes_4_out_1 = 831 AutoAxes( 832 main_Scale_5_out_1, 833 main_AutoCamera_4_out_1, 834 main_AutoAxes_4_in_3, 835 main_AutoAxes_4_in_4, 836 main_AutoAxes_4_in_5, 837 main_AutoAxes_4_in_6, 838 main_AutoAxes_4_in_7, 839 main_AutoAxes_4_in_8, 840 main_AutoAxes_4_in_9, 841 main_AutoAxes_4_in_10, 842 main_AutoAxes_4_in_11, 843 main_AutoAxes_4_in_12, 844 main_AutoAxes_4_in_13, 845 main_AutoAxes_4_in_14, 846 main_AutoAxes_4_in_15, 847 main_AutoAxes_4_in_16, 848 main_AutoAxes_4_in_17, 849 main_AutoAxes_4_in_18, 850 main_AutoAxes_4_in_19 851 ) [instance: 4, cache: 1]; 852 // 853 // node Selector[1]: x = 245, y = 66, inputs = 7, label = Selector 854 // input[1]: defaulting = 0, visible = 0, type = 32, value = "Selector_1" 855 // input[2]: defaulting = 0, visible = 0, type = 32, value = "Colour" 856 // input[3]: defaulting = 0, visible = 0, type = 29, value = 1 857 // input[4]: defaulting = 1, visible = 1, type = 16777248, value = { "Colour" "Grey" } 858 // input[5]: defaulting = 1, visible = 0, type = 16777245, value = { 1 2 } 859 // output[1]: visible = 1, type = 29, value = 1 860 // output[2]: visible = 1, type = 32, value = "Colour" 861 // page group: Image 862 // 863 // 864 // node Transmitter[6]: x = 299, y = 487, inputs = 1, label = ColourImage 865 // page group: ColourScene 866 // 867 ColourImage = main_AutoAxes_4_out_1; 868 // 869 // node Receiver[5]: x = 76, y = 190, inputs = 1, label = ColourImage 870 // page group: Image 871 // 872 main_Receiver_5_out_1[cache: 0] = ColourImage; 873 // 874 // node Transmitter[5]: x = 305, y = 489, inputs = 1, label = GreyImage 875 // page group: GreyScene 876 // 877 GreyImage = main_AutoAxes_2_out_1; 878 // 879 // node Receiver[6]: x = 199, y = 190, inputs = 1, label = GreyImage 880 // page group: Image 881 // 882 main_Receiver_6_out_1[cache: 0] = GreyImage; 883 // 884 // node Switch[1]: x = 177, y = 293, inputs = 3, label = Switch 885 // page group: Image 886 // 887 main_Switch_1_out_1 = 888 Switch( 889 main_Selector_1_out_1, 890 main_Receiver_5_out_1, 891 main_Receiver_6_out_1 892 ) [instance: 1, cache: 1]; 893 // 894 // node Switch[14]: x = 325, y = 293, inputs = 3, label = Switch 895 // input[2]: defaulting = 0, visible = 1, type = 67108863, value = "black" 896 // input[3]: defaulting = 0, visible = 1, type = 67108863, value = "white" 897 // page group: Image 898 // 899 main_Switch_14_out_1 = 900 Switch( 901 main_Selector_1_out_1, 902 main_Switch_14_in_2, 903 main_Switch_14_in_3 904 ) [instance: 14, cache: 1]; 905 // 906 // node Image[3]: x = 252, y = 424, inputs = 49, label = Image 907 // input[1]: defaulting = 0, visible = 0, type = 67108863, value = "Image_3" 908 // input[4]: defaulting = 0, visible = 0, type = 1, value = 1 909 // input[5]: defaulting = 0, visible = 0, type = 8, value = """ + image_array1 + """ 910 // input[6]: defaulting = 0, visible = 0, type = 8, value = """ + image_array2 + """ 911 // input[7]: defaulting = 0, visible = 0, type = 5, value = """ + image_val + """ 912 // input[8]: defaulting = 0, visible = 0, type = 1, value = 1376 913 // input[9]: defaulting = 0, visible = 0, type = 5, value = 0.678 914 // input[10]: defaulting = 0, visible = 0, type = 8, value = [-0.109685 0.243133 0.963772] 915 // input[11]: defaulting = 1, visible = 0, type = 5, value = 30.9877 916 // input[12]: defaulting = 0, visible = 0, type = 1, value = 0 917 // input[14]: defaulting = 0, visible = 0, type = 1, value = 1 918 // input[15]: defaulting = 0, visible = 0, type = 32, value = "none" 919 // input[16]: defaulting = 0, visible = 0, type = 32, value = "none" 920 // input[17]: defaulting = 1, visible = 0, type = 1, value = 1 921 // input[18]: defaulting = 1, visible = 0, type = 1, value = 1 922 // input[19]: defaulting = 0, visible = 0, type = 1, value = 0 923 // input[22]: defaulting = 1, visible = 1, type = 32, value = "black" 924 // input[25]: defaulting = 0, visible = 0, type = 32, value = "iso" 925 // input[26]: defaulting = 0, visible = 0, type = 32, value = "tiff" 926 // input[29]: defaulting = 0, visible = 0, type = 3, value = 0 927 // input[30]: defaulting = 1, visible = 0, type = 16777248, value = """ + self.labels + """ 928 // input[32]: defaulting = 1, visible = 0, type = 16777224, value = """ + self.corners + """ 929 // input[33]: defaulting = 0, visible = 0, type = 3, value = 1 930 // input[34]: defaulting = 0, visible = 0, type = 3, value = 0 931 // input[36]: defaulting = 0, visible = 0, type = 3, value = 1 932 // input[41]: defaulting = 0, visible = 0, type = 32, value = "rotate" 933 // input[42]: defaulting = 0, visible = 0, type = 32, value = "Surface" 934 // page group: Image 935 // title: value = Surface 936 // depth: value = 24 937 // window: position = (0.0000,0.0400), size = 0.9929x0.9276 938 // internal caching: 1 939 // 940 main_Image_3_out_1, 941 main_Image_3_out_2, 942 main_Image_3_out_3 = 943 Image( 944 main_Image_3_in_1, 945 main_Switch_1_out_1, 946 main_Image_3_in_3, 947 main_Image_3_in_4, 948 main_Image_3_in_5, 949 main_Image_3_in_6, 950 main_Image_3_in_7, 951 main_Image_3_in_8, 952 main_Image_3_in_9, 953 main_Image_3_in_10, 954 main_Image_3_in_11, 955 main_Image_3_in_12, 956 main_Image_3_in_13, 957 main_Image_3_in_14, 958 main_Image_3_in_15, 959 main_Image_3_in_16, 960 main_Image_3_in_17, 961 main_Image_3_in_18, 962 main_Image_3_in_19, 963 main_Image_3_in_20, 964 main_Image_3_in_21, 965 main_Switch_14_out_1, 966 main_Image_3_in_23, 967 main_Image_3_in_24, 968 main_Image_3_in_25, 969 main_Image_3_in_26, 970 main_Image_3_in_27, 971 main_Image_3_in_28, 972 main_Image_3_in_29, 973 main_Image_3_in_30, 974 main_Image_3_in_31, 975 main_Image_3_in_32, 976 main_Image_3_in_33, 977 main_Image_3_in_34, 978 main_Image_3_in_35, 979 main_Image_3_in_36, 980 main_Image_3_in_37, 981 main_Image_3_in_38, 982 main_Image_3_in_39, 983 main_Image_3_in_40, 984 main_Image_3_in_41, 985 main_Image_3_in_42, 986 main_Image_3_in_43, 987 main_Image_3_in_44, 988 main_Image_3_in_45, 989 main_Image_3_in_46, 990 main_Image_3_in_47, 991 main_Image_3_in_48, 992 main_Image_3_in_49 993 ) [instance: 3, cache: 1]; 994 // network: end of macro body 995 CacheScene(main_Image_3_in_1, main_Image_3_out_1, main_Image_3_out_2); 996 }""" 997 998 # Include the sphere. 999 if self.num_points == 1: 1000 text = text + """ 1001 main_Import_4_in_1 = \"""" + self.point_file + """.general"; 1002 main_Import_4_in_2 = NULL; 1003 main_Import_4_in_3 = NULL; 1004 main_Import_4_in_4 = NULL; 1005 main_Import_4_in_5 = NULL; 1006 main_Import_4_in_6 = NULL; 1007 main_Import_4_out_1 = NULL; 1008 main_Glyph_2_in_2 = "sphere"; 1009 main_Glyph_2_in_3 = NULL; 1010 main_Glyph_2_in_4 = """ + self.sphere_size + """; 1011 main_Glyph_2_in_5 = 0.0; 1012 main_Glyph_2_in_6 = NULL; 1013 main_Glyph_2_in_7 = NULL; 1014 main_Glyph_2_out_1 = NULL; 1015 main_Color_10_in_2 = [0 0 0]; 1016 main_Color_10_in_3 = 1.0; 1017 main_Color_10_in_4 = NULL; 1018 main_Color_10_in_5 = NULL; 1019 main_Color_10_out_1 = NULL; 1020 main_Transmitter_1_out_1 = NULL; 1021 main_Receiver_2_out_1 = NULL;""" 1022 1023 # Common code. 1024 text = text + """ 1025 main_Import_3_in_1 = \"""" + self.file + """.general"; 1026 main_Import_3_in_2 = NULL; 1027 main_Import_3_in_3 = NULL; 1028 main_Import_3_in_4 = NULL; 1029 main_Import_3_in_5 = NULL; 1030 main_Import_3_in_6 = NULL; 1031 main_Import_3_out_1 = NULL; 1032 main_Isosurface_5_in_2 = 500.0; 1033 main_Isosurface_5_in_3 = NULL; 1034 main_Isosurface_5_in_4 = NULL; 1035 main_Isosurface_5_in_5 = NULL; 1036 main_Isosurface_5_in_6 = NULL; 1037 main_Isosurface_5_out_1 = NULL; 1038 main_Transmitter_7_out_1 = NULL; 1039 main_Receiver_14_out_1 = NULL; 1040 main_Color_6_in_2 = [0 0 0]; 1041 main_Color_6_in_3 = 0.2; 1042 main_Color_6_in_4 = NULL; 1043 main_Color_6_in_5 = NULL; 1044 main_Color_6_out_1 = NULL; 1045 main_Isosurface_6_in_2 = 100.0; 1046 main_Isosurface_6_in_3 = NULL; 1047 main_Isosurface_6_in_4 = NULL; 1048 main_Isosurface_6_in_5 = NULL; 1049 main_Isosurface_6_in_6 = NULL; 1050 main_Isosurface_6_out_1 = NULL; 1051 main_Transmitter_8_out_1 = NULL; 1052 main_Receiver_13_out_1 = NULL; 1053 main_Color_7_in_2 = [0.2 0.2 0.2]; 1054 main_Color_7_in_3 = 0.4; 1055 main_Color_7_in_4 = NULL; 1056 main_Color_7_in_5 = NULL; 1057 main_Color_7_out_1 = NULL; 1058 main_Collect_5_out_1 = NULL; 1059 main_Isosurface_7_in_2 = 20.0; 1060 main_Isosurface_7_in_3 = NULL; 1061 main_Isosurface_7_in_4 = NULL; 1062 main_Isosurface_7_in_5 = NULL; 1063 main_Isosurface_7_in_6 = NULL; 1064 main_Isosurface_7_out_1 = NULL; 1065 main_Transmitter_9_out_1 = NULL; 1066 main_Receiver_12_out_1 = NULL; 1067 main_Color_8_in_2 = [0.5 0.5 0.5]; 1068 main_Color_8_in_3 = 0.5; 1069 main_Color_8_in_4 = NULL; 1070 main_Color_8_in_5 = NULL; 1071 main_Color_8_out_1 = NULL; 1072 main_Isosurface_8_in_2 = 7.0; 1073 main_Isosurface_8_in_3 = NULL; 1074 main_Isosurface_8_in_4 = NULL; 1075 main_Isosurface_8_in_5 = NULL; 1076 main_Isosurface_8_in_6 = NULL; 1077 main_Isosurface_8_out_1 = NULL; 1078 main_Transmitter_10_out_1 = NULL; 1079 main_Receiver_11_out_1 = NULL; 1080 main_Color_9_in_2 = "white"; 1081 main_Color_9_in_3 = 0.7; 1082 main_Color_9_in_4 = NULL; 1083 main_Color_9_in_5 = NULL; 1084 main_Color_9_out_1 = NULL; 1085 main_Collect_6_out_1 = NULL; 1086 main_Collect_7_out_1 = NULL;""" 1087 1088 # Include the sphere. 1089 if self.num_points == 1: 1090 text = text + """ 1091 main_Collect_8_out_1 = NULL;""" 1092 1093 # Common code. 1094 text = text + """ 1095 main_Transmitter_4_out_1 = NULL; 1096 main_Receiver_3_out_1 = NULL; 1097 main_Scale_3_in_2 = [1 1 1]; 1098 main_Scale_3_out_1 = NULL; 1099 main_AutoCamera_2_in_2 = [1 -1 1]; 1100 main_AutoCamera_2_in_3 = NULL; 1101 main_AutoCamera_2_in_4 = 640; 1102 main_AutoCamera_2_in_5 = .75; 1103 main_AutoCamera_2_in_6 = [-1 1 0 ]; 1104 main_AutoCamera_2_in_7 = 0; 1105 main_AutoCamera_2_in_8 = 30.0; 1106 main_AutoCamera_2_in_9 = "white"; 1107 main_AutoCamera_2_out_1 = NULL; 1108 main_AutoAxes_2_in_3 = """ + self.labels + """; 1109 main_AutoAxes_2_in_4 = 30; 1110 main_AutoAxes_2_in_5 = """ + self.corners + """; 1111 main_AutoAxes_2_in_6 = 1; 1112 main_AutoAxes_2_in_7 = NULL; 1113 main_AutoAxes_2_in_8 = NULL; 1114 main_AutoAxes_2_in_9 = 1; 1115 main_AutoAxes_2_in_10 = {[1 1 1] [0.1 0.1 0.1] [0 0 0] [0 0 0]}; 1116 main_AutoAxes_2_in_11 = {"background" "grid" "labels" "ticks"}; 1117 main_AutoAxes_2_in_12 = NULL; 1118 main_AutoAxes_2_in_13 = "area"; 1119 main_AutoAxes_2_in_14 = """ + self.tick_locations[0] + """; 1120 main_AutoAxes_2_in_15 = """ + self.tick_locations[1] + """; 1121 main_AutoAxes_2_in_16 = """ + self.tick_locations[2] + """; 1122 main_AutoAxes_2_in_17 = """ + self.tick_values[0] + """; 1123 main_AutoAxes_2_in_18 = """ + self.tick_values[1] + """; 1124 main_AutoAxes_2_in_19 = """ + self.tick_values[2] + """; 1125 main_AutoAxes_2_out_1 = NULL;""" 1126 1127 # Include the sphere. 1128 if self.num_points == 1: 1129 text = text + """ 1130 main_Color_11_in_2 = [1 0 0]; 1131 main_Color_11_in_3 = 1.0; 1132 main_Color_11_in_4 = NULL; 1133 main_Color_11_in_5 = NULL; 1134 main_Color_11_out_1 = NULL; 1135 main_Transmitter_2_out_1 = NULL; 1136 main_Receiver_1_out_1 = NULL;""" 1137 1138 # Common code. 1139 text = text + """ 1140 main_Receiver_10_out_1 = NULL; 1141 main_Color_12_in_2 = [0 0 0.2]; 1142 main_Color_12_in_3 = 0.3; 1143 main_Color_12_in_4 = NULL; 1144 main_Color_12_in_5 = NULL; 1145 main_Color_12_out_1 = NULL; 1146 main_Receiver_9_out_1 = NULL; 1147 main_Color_13_in_2 = "blue"; 1148 main_Color_13_in_3 = 0.3; 1149 main_Color_13_in_4 = NULL; 1150 main_Color_13_in_5 = NULL; 1151 main_Color_13_out_1 = NULL; 1152 main_Collect_9_out_1 = NULL; 1153 main_Receiver_8_out_1 = NULL; 1154 main_Color_14_in_2 = [0.5 0.5 1]; 1155 main_Color_14_in_3 = 0.2; 1156 main_Color_14_in_4 = NULL; 1157 main_Color_14_in_5 = NULL; 1158 main_Color_14_out_1 = NULL; 1159 main_Receiver_7_out_1 = NULL; 1160 main_Color_15_in_2 = "white"; 1161 main_Color_15_in_3 = 0.55; 1162 main_Color_15_in_4 = NULL; 1163 main_Color_15_in_5 = NULL; 1164 main_Color_15_out_1 = NULL; 1165 main_Collect_10_out_1 = NULL; 1166 main_Collect_11_out_1 = NULL;""" 1167 1168 # Include the sphere. 1169 if self.num_points == 1: 1170 text = text + """ 1171 main_Collect_12_out_1 = NULL;""" 1172 1173 # Common code. 1174 text = text + """ 1175 main_Transmitter_3_out_1 = NULL; 1176 main_Receiver_4_out_1 = NULL; 1177 main_Scale_5_in_2 = [1 1 1]; 1178 main_Scale_5_out_1 = NULL; 1179 main_AutoCamera_4_in_2 = [1 -1 1]; 1180 main_AutoCamera_4_in_3 = NULL; 1181 main_AutoCamera_4_in_4 = NULL; 1182 main_AutoCamera_4_in_5 = .75; 1183 main_AutoCamera_4_in_6 = [-1 1 0 ]; 1184 main_AutoCamera_4_in_7 = 0; 1185 main_AutoCamera_4_in_8 = 30.0; 1186 main_AutoCamera_4_in_9 = "black"; 1187 main_AutoCamera_4_out_1 = NULL; 1188 main_AutoAxes_4_in_3 = """ + self.labels + """; 1189 main_AutoAxes_4_in_4 = 30; 1190 main_AutoAxes_4_in_5 = """ + self.corners + """; 1191 main_AutoAxes_4_in_6 = 1; 1192 main_AutoAxes_4_in_7 = NULL; 1193 main_AutoAxes_4_in_8 = NULL; 1194 main_AutoAxes_4_in_9 = 1; 1195 main_AutoAxes_4_in_10 = {[0.05 0.05 0.05] [0.3 0.3 0.3] [1 1 1] [1 1 0]}; 1196 main_AutoAxes_4_in_11 = {"background" "grid" "labels" "ticks"}; 1197 main_AutoAxes_4_in_12 = NULL; 1198 main_AutoAxes_4_in_13 = "area"; 1199 main_AutoAxes_4_in_14 = """ + self.tick_locations[0] + """; 1200 main_AutoAxes_4_in_15 = """ + self.tick_locations[1] + """; 1201 main_AutoAxes_4_in_16 = """ + self.tick_locations[2] + """; 1202 main_AutoAxes_4_in_17 = """ + self.tick_values[0] + """; 1203 main_AutoAxes_4_in_18 = """ + self.tick_values[1] + """; 1204 main_AutoAxes_4_in_19 = """ + self.tick_values[2] + """; 1205 main_AutoAxes_4_out_1 = NULL; 1206 main_Selector_1_in_1 = "Selector_1"; 1207 main_Selector_1_in_2 = "Colour" ; 1208 main_Selector_1_in_3 = 1 ; 1209 main_Selector_1_in_4 = NULL; 1210 main_Selector_1_in_5 = NULL; 1211 main_Selector_1_in_6 = NULL; 1212 main_Selector_1_in_7 = NULL; 1213 main_Selector_1_out_1 = 1 ; 1214 main_Transmitter_6_out_1 = NULL; 1215 main_Receiver_5_out_1 = NULL; 1216 main_Transmitter_5_out_1 = NULL; 1217 main_Receiver_6_out_1 = NULL; 1218 main_Switch_1_out_1 = NULL; 1219 main_Switch_14_in_2 = "black"; 1220 main_Switch_14_in_3 = "white"; 1221 main_Switch_14_out_1 = NULL; 1222 macro Image( 1223 id, 1224 object, 1225 where, 1226 useVector, 1227 to, 1228 from, 1229 width, 1230 resolution, 1231 aspect, 1232 up, 1233 viewAngle, 1234 perspective, 1235 options, 1236 buttonState = 1, 1237 buttonUpApprox = "none", 1238 buttonDownApprox = "none", 1239 buttonUpDensity = 1, 1240 buttonDownDensity = 1, 1241 renderMode = 0, 1242 defaultCamera, 1243 reset, 1244 backgroundColor, 1245 throttle, 1246 RECenable = 0, 1247 RECfile, 1248 RECformat, 1249 RECresolution, 1250 RECaspect, 1251 AAenable = 0, 1252 AAlabels, 1253 AAticks, 1254 AAcorners, 1255 AAframe, 1256 AAadjust, 1257 AAcursor, 1258 AAgrid, 1259 AAcolors, 1260 AAannotation, 1261 AAlabelscale, 1262 AAfont, 1263 interactionMode, 1264 title, 1265 AAxTickLocs, 1266 AAyTickLocs, 1267 AAzTickLocs, 1268 AAxTickLabels, 1269 AAyTickLabels, 1270 AAzTickLabels, 1271 webOptions) -> ( 1272 object, 1273 camera, 1274 where) 1275 { 1276 ImageMessage( 1277 id, 1278 backgroundColor, 1279 throttle, 1280 RECenable, 1281 RECfile, 1282 RECformat, 1283 RECresolution, 1284 RECaspect, 1285 AAenable, 1286 AAlabels, 1287 AAticks, 1288 AAcorners, 1289 AAframe, 1290 AAadjust, 1291 AAcursor, 1292 AAgrid, 1293 AAcolors, 1294 AAannotation, 1295 AAlabelscale, 1296 AAfont, 1297 AAxTickLocs, 1298 AAyTickLocs, 1299 AAzTickLocs, 1300 AAxTickLabels, 1301 AAyTickLabels, 1302 AAzTickLabels, 1303 interactionMode, 1304 title, 1305 renderMode, 1306 buttonUpApprox, 1307 buttonDownApprox, 1308 buttonUpDensity, 1309 buttonDownDensity) [instance: 1, cache: 1]; 1310 autoCamera = 1311 AutoCamera( 1312 object, 1313 "front", 1314 object, 1315 resolution, 1316 aspect, 1317 [0,1,0], 1318 perspective, 1319 viewAngle, 1320 backgroundColor) [instance: 1, cache: 1]; 1321 realCamera = 1322 Camera( 1323 to, 1324 from, 1325 width, 1326 resolution, 1327 aspect, 1328 up, 1329 perspective, 1330 viewAngle, 1331 backgroundColor) [instance: 1, cache: 1]; 1332 coloredDefaultCamera = 1333 UpdateCamera(defaultCamera, 1334 background=backgroundColor) [instance: 1, cache: 1]; 1335 nullDefaultCamera = 1336 Inquire(defaultCamera, 1337 "is null + 1") [instance: 1, cache: 1]; 1338 resetCamera = 1339 Switch( 1340 nullDefaultCamera, 1341 coloredDefaultCamera, 1342 autoCamera) [instance: 1, cache: 1]; 1343 resetNull = 1344 Inquire( 1345 reset, 1346 "is null + 1") [instance: 2, cache: 1]; 1347 reset = 1348 Switch( 1349 resetNull, 1350 reset, 1351 0) [instance: 2, cache: 1]; 1352 whichCamera = 1353 Compute( 1354 "($0 != 0 || $1 == 0) ? 1 : 2", 1355 reset, 1356 useVector) [instance: 1, cache: 1]; 1357 camera = Switch( 1358 whichCamera, 1359 resetCamera, 1360 realCamera) [instance: 3, cache: 1]; 1361 AAobject = 1362 AutoAxes( 1363 object, 1364 camera, 1365 AAlabels, 1366 AAticks, 1367 AAcorners, 1368 AAframe, 1369 AAadjust, 1370 AAcursor, 1371 AAgrid, 1372 AAcolors, 1373 AAannotation, 1374 AAlabelscale, 1375 AAfont, 1376 AAxTickLocs, 1377 AAyTickLocs, 1378 AAzTickLocs, 1379 AAxTickLabels, 1380 AAyTickLabels, 1381 AAzTickLabels) [instance: 1, cache: 1]; 1382 switchAAenable = Compute("$0+1", 1383 AAenable) [instance: 2, cache: 1]; 1384 object = Switch( 1385 switchAAenable, 1386 object, 1387 AAobject) [instance:4, cache: 1]; 1388 SWapproximation_options = 1389 Switch( 1390 buttonState, 1391 buttonUpApprox, 1392 buttonDownApprox) [instance: 5, cache: 1]; 1393 SWdensity_options = 1394 Switch( 1395 buttonState, 1396 buttonUpDensity, 1397 buttonDownDensity) [instance: 6, cache: 1]; 1398 HWapproximation_options = 1399 Format( 1400 "%s,%s", 1401 buttonDownApprox, 1402 buttonUpApprox) [instance: 1, cache: 1]; 1403 HWdensity_options = 1404 Format( 1405 "%d,%d", 1406 buttonDownDensity, 1407 buttonUpDensity) [instance: 2, cache: 1]; 1408 switchRenderMode = Compute( 1409 "$0+1", 1410 renderMode) [instance: 3, cache: 1]; 1411 approximation_options = Switch( 1412 switchRenderMode, 1413 SWapproximation_options, 1414 HWapproximation_options) [instance: 7, cache: 1]; 1415 density_options = Switch( 1416 switchRenderMode, 1417 SWdensity_options, 1418 HWdensity_options) [instance: 8, cache: 1]; 1419 renderModeString = Switch( 1420 switchRenderMode, 1421 "software", 1422 "hardware")[instance: 9, cache: 1]; 1423 object_tag = Inquire( 1424 object, 1425 "object tag")[instance: 3, cache: 1]; 1426 annoted_object = 1427 Options( 1428 object, 1429 "send boxes", 1430 0, 1431 "cache", 1432 1, 1433 "object tag", 1434 object_tag, 1435 "ddcamera", 1436 whichCamera, 1437 "rendering approximation", 1438 approximation_options, 1439 "render every", 1440 density_options, 1441 "button state", 1442 buttonState, 1443 "rendering mode", 1444 renderModeString) [instance: 1, cache: 1]; 1445 RECresNull = 1446 Inquire( 1447 RECresolution, 1448 "is null + 1") [instance: 4, cache: 1]; 1449 ImageResolution = 1450 Inquire( 1451 camera, 1452 "camera resolution") [instance: 5, cache: 1]; 1453 RECresolution = 1454 Switch( 1455 RECresNull, 1456 RECresolution, 1457 ImageResolution) [instance: 10, cache: 1]; 1458 RECaspectNull = 1459 Inquire( 1460 RECaspect, 1461 "is null + 1") [instance: 6, cache: 1]; 1462 ImageAspect = 1463 Inquire( 1464 camera, 1465 "camera aspect") [instance: 7, cache: 1]; 1466 RECaspect = 1467 Switch( 1468 RECaspectNull, 1469 RECaspect, 1470 ImageAspect) [instance: 11, cache: 1]; 1471 switchRECenable = Compute( 1472 "$0 == 0 ? 1 : (($2 == $3) && ($4 == $5)) ? ($1 == 1 ? 2 : 3) : 4", 1473 RECenable, 1474 switchRenderMode, 1475 RECresolution, 1476 ImageResolution, 1477 RECaspect, 1478 ImageAspect) [instance: 4, cache: 1]; 1479 NoRECobject, RECNoRerenderObject, RECNoRerHW, RECRerenderObject = Route(switchRECenable, annoted_object); 1480 Display( 1481 NoRECobject, 1482 camera, 1483 where, 1484 throttle) [instance: 1, cache: 1]; 1485 image = 1486 Render( 1487 RECNoRerenderObject, 1488 camera) [instance: 1, cache: 1]; 1489 Display( 1490 image, 1491 NULL, 1492 where, 1493 throttle) [instance: 2, cache: 1]; 1494 WriteImage( 1495 image, 1496 RECfile, 1497 RECformat) [instance: 1, cache: 1]; 1498 rec_where = Display( 1499 RECNoRerHW, 1500 camera, 1501 where, 1502 throttle) [instance: 1, cache: 0]; 1503 rec_image = ReadImageWindow( 1504 rec_where) [instance: 1, cache: 1]; 1505 WriteImage( 1506 rec_image, 1507 RECfile, 1508 RECformat) [instance: 1, cache: 1]; 1509 RECupdateCamera = 1510 UpdateCamera( 1511 camera, 1512 resolution=RECresolution, 1513 aspect=RECaspect) [instance: 2, cache: 1]; 1514 Display( 1515 RECRerenderObject, 1516 camera, 1517 where, 1518 throttle) [instance: 1, cache: 1]; 1519 RECRerenderObject = 1520 ScaleScreen( 1521 RECRerenderObject, 1522 NULL, 1523 RECresolution, 1524 camera) [instance: 1, cache: 1]; 1525 image = 1526 Render( 1527 RECRerenderObject, 1528 RECupdateCamera) [instance: 2, cache: 1]; 1529 WriteImage( 1530 image, 1531 RECfile, 1532 RECformat) [instance: 2, cache: 1]; 1533 } 1534 main_Image_3_in_1 = "Image_3"; 1535 main_Image_3_in_3 = "X24,,Surface"; 1536 main_Image_3_in_4 = 1; 1537 main_Image_3_in_5 = """ + image_array1 + """; 1538 main_Image_3_in_6 = """ + image_array2 + """; 1539 main_Image_3_in_7 = """ + image_val + """; 1540 main_Image_3_in_8 = 1376; 1541 main_Image_3_in_9 = 0.678; 1542 main_Image_3_in_10 = [-0.109685 0.243133 0.963772]; 1543 main_Image_3_in_11 = NULL; 1544 main_Image_3_in_12 = 0; 1545 main_Image_3_in_13 = NULL; 1546 main_Image_3_in_14 = 1; 1547 main_Image_3_in_15 = "none"; 1548 main_Image_3_in_16 = "none"; 1549 main_Image_3_in_17 = NULL; 1550 main_Image_3_in_18 = NULL; 1551 main_Image_3_in_19 = 0; 1552 main_Image_3_in_20 = NULL; 1553 main_Image_3_in_21 = NULL; 1554 main_Image_3_in_23 = NULL; 1555 main_Image_3_in_25 = "iso"; 1556 main_Image_3_in_26 = "tiff"; 1557 main_Image_3_in_27 = NULL; 1558 main_Image_3_in_28 = NULL; 1559 main_Image_3_in_29 = 0; 1560 main_Image_3_in_30 = NULL; 1561 main_Image_3_in_31 = NULL; 1562 main_Image_3_in_32 = NULL; 1563 main_Image_3_in_33 = 1; 1564 main_Image_3_in_34 = 0; 1565 main_Image_3_in_35 = NULL; 1566 main_Image_3_in_36 = 1; 1567 main_Image_3_in_37 = NULL; 1568 main_Image_3_in_38 = NULL; 1569 main_Image_3_in_39 = NULL; 1570 main_Image_3_in_40 = NULL; 1571 main_Image_3_in_41 = "rotate"; 1572 main_Image_3_in_42 = "Surface"; 1573 main_Image_3_in_43 = NULL; 1574 main_Image_3_in_44 = NULL; 1575 main_Image_3_in_45 = NULL; 1576 main_Image_3_in_46 = NULL; 1577 main_Image_3_in_47 = NULL; 1578 main_Image_3_in_48 = NULL; 1579 main_Image_3_in_49 = NULL; 1580 Executive("product version 4 3 2"); 1581 $sync 1582 main(); 1583 """ 1584 1585 # Return the text. 1586 return text
1587