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

Source Code for Module opendx.isosurface_3D

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