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

Source Code for Module opendx.isosurface_3D

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