forked from DIDSR/breastPhantom
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbreastPhantom.cxx
4888 lines (4252 loc) · 161 KB
/
breastPhantom.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*! \file breastPhantom.cxx
* \brief breastPhantom main file
* \author Christian G. Graff
* \version 1.0
* \date 2018
*
* \copyright To the extent possible under law, the author(s) have
* dedicated all copyright and related and neighboring rights to this
* software to the public domain worldwide. This software is
* distributed without any warranty. You should have received a copy
* of the CC0 Public Domain Dedication along with this software.
* If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*
*/
// create volumetric breast
#include "breastPhantom.hxx"
namespace po = boost::program_options;
unsigned int ductTree::num = 0;
unsigned int arteryTree::num = 0;
unsigned int veinTree::num = 0;
int main(int argc, char* argv[]){
double pi = vtkMath::Pi();
// configuration file variables
po::options_description baseOpt("base options");
baseOpt.add_options()
("base.outputDir",po::value<std::string>()->default_value("."),"output directory")
("base.imgRes",po::value<double>()->default_value(0.25),"phantom resolution (mm)")
("base.skinThick",po::value<double>()->default_value(0.75),"skin thickness (mm)")
("base.nippleLen",po::value<double>()->default_value(4.0),"nipple length (mm)")
("base.nippleRad",po::value<double>()->default_value(4.0),"nipple radius (mm)")
("base.areolaRad",po::value<double>()->default_value(8.0),"areola radius (mm)")
("base.leftBreast",po::value<bool>()->default_value(true),"left side breast (boolean)")
("base.targetFatFrac",po::value<double>()->default_value(0.75),"desired fraction of breast to be fat")
("base.seed",po::value<unsigned int>(),"random number generator seed")
;
po::options_description shapeOpt("breast shape options");
shapeOpt.add_options()
("shape.ures",po::value<double>()->default_value(0.02),"u resolution of base shape")
("shape.vres",po::value<double>()->default_value(0.02),"v resolution of base shape")
("shape.pointSep",po::value<double>()->default_value(0.01),"minimum point separation (mm)")
("shape.ringWidth",po::value<double>()->default_value(10.0),"thickness of back ring (mm)")
("shape.ringSep",po::value<double>()->default_value(0.5),"ring node step size (mm)")
("shape.featureAngle",po::value<double>()->default_value(20.0),"angle to preserve while smoothing (degrees)")
("shape.targetReduction",po::value<double>()->default_value(0.05),"fraction of triangles to decimate")
("shape.a1b",po::value<double>()->default_value(1.0),"bottom size")
("shape.a1t",po::value<double>()->default_value(1.0),"top size")
("shape.a2l",po::value<double>()->default_value(1.0),"left size")
("shape.a2r",po::value<double>()->default_value(1.0),"right size")
("shape.a3",po::value<double>()->default_value(1.0),"outward size")
("shape.eps1",po::value<double>()->default_value(1.0),"u quadric exponent")
("shape.eps2",po::value<double>()->default_value(1.0),"v quadric exponent")
("shape.doPtosis",po::value<bool>()->default_value(false),"ptosis deformation (boolean)")
("shape.ptosisB0",po::value<double>()->default_value(0.4),"ptosis b0")
("shape.ptosisB1",po::value<double>()->default_value(0.3),"ptosis b1")
("shape.doTurn",po::value<bool>()->default_value(false),"turn deformation (boolean)")
("shape.turnC0",po::value<double>()->default_value(-0.4),"turn c0")
("shape.turnC1",po::value<double>()->default_value(0.2),"turn c1")
("shape.doTopShape",po::value<bool>()->default_value(false),"top shape deformation (boolean)")
("shape.topShapeS0",po::value<double>()->default_value(1.54),"top shape s0")
("shape.topShapeS1",po::value<double>()->default_value(1.3),"top shape s1")
("shape.topShapeT0",po::value<double>()->default_value(-3.0),"top shape t0")
("shape.topShapeT1",po::value<double>()->default_value(-1.0),"top shape t1")
("shape.doFlattenSide",po::value<bool>()->default_value(false),"flatten side deformation (boolean)")
("shape.flattenSideG0",po::value<double>()->default_value(-0.4),"flatten side g0")
("shape.flattenSideG1",po::value<double>()->default_value(0.2),"flatten side g1")
("shape.doTurnTop",po::value<bool>()->default_value(false),"turn top deformation (boolean)")
("shape.turnTopH0",po::value<double>()->default_value(-2.7),"turn top h0")
("shape.turnTopH1",po::value<double>()->default_value(-3.7),"turn top h1")
;
po::options_description compartOpt("breast compartment options");
compartOpt.add_options()
("compartments.num",po::value<int>()->default_value(8),"number of breast compartments")
("compartments.seedBaseDist",po::value<double>()->default_value(12.5),"distance along nipple line of compartment seed base (mm)")
("compartments.backFatBufferFrac",po::value<double>()->default_value(0.2),"fraction of phantom in nipple direction forced to be fat")
("compartments.numBackSeeds",po::value<int>()->default_value(100),"number of backplane seed points")
("compartments.angularJitter",po::value<double>()->default_value(0.125),"maximum seed jitter (fraction of subtended angle)")
("compartments.zJitter",po::value<double>()->default_value(5.0),"maximum seed jitter in nipple direction (mm)")
("compartments.maxFracRadialDist",po::value<double>()->default_value(0.5),"maximum radial distance from base seed as a fraction of distance to breast surface")
("compartments.minFracRadialDist",po::value<double>()->default_value(0.25),"minimum radial distance from base seed as a fraction of distance to breast surface")
("compartments.minScaleNippleDir",po::value<double>()->default_value(0.01),"minimum scale in nipple direction")
("compartments.maxScaleNippleDir",po::value<double>()->default_value(0.01),"maximum scale in nipple direction")
("compartments.minScale",po::value<double>()->default_value(50.0),"minimum scale in non-nipple direction")
("compartments.maxScale",po::value<double>()->default_value(60.0),"maximum scale in non-nipple direction")
("compartments.minGlandStrength",po::value<double>()->default_value(20.0),"minimum gland strength")
("compartments.maxGlandStrength",po::value<double>()->default_value(20.0),"maximum gland strength")
("compartments.maxDeflect",po::value<double>()->default_value(0.01),"maximum compartment deflection angle from pointing towards nipple (fraction of pi)")
("compartments.minSkinScaleNippleDir",po::value<double>()->default_value(0.01),"minimum scale skin seeds in nipple direction")
("compartments.maxSkinScaleNippleDir",po::value<double>()->default_value(0.01),"maximum scale skin seeds in nipple direction")
("compartments.minSkinScale",po::value<double>()->default_value(70.0),"minimum scale skin in non-nipple direction")
("compartments.maxSkinScale",po::value<double>()->default_value(70.0),"maximum scale skin in non-nipple direction")
("compartments.skinStrength",po::value<double>()->default_value(20.0),"skin strength")
("compartments.backScale",po::value<double>()->default_value(50.0),"back scale")
("compartments.backStrength",po::value<double>()->default_value(50.0),"back strength")
("compartments.nippleScale",po::value<double>()->default_value(50.0),"nipple scale")
("compartments.nippleStrength",po::value<double>()->default_value(50.0),"nipple strength")
("compartments.voronSeedRadius",po::value<double>()->default_value(40.0),"check all seeds in radius (mm)")
;
po::options_description TDLUOpt("TDLU options");
TDLUOpt.add_options()
("TDLU.maxLength",po::value<double>()->default_value(4.0),"maximum TDLU length")
("TDLU.minLength",po::value<double>()->default_value(2.0),"minimum TDLU length")
("TDLU.maxWidth",po::value<double>()->default_value(2.0),"maximum TDLU width")
("TDLU.minWidth",po::value<double>()->default_value(1.0),"minimum TDLU width")
;
po::options_description perlinOpt("Perlin noise options");
perlinOpt.add_options()
("perlin.maxDeviation",po::value<double>()->default_value(0.1),"maximum perlin perturbation fraction of radius")
("perlin.frequency",po::value<double>()->default_value(0.5),"starting frequency")
("perlin.lacunarity",po::value<double>()->default_value(1.5),"octave frequency multiplier")
("perlin.persistence",po::value<double>()->default_value(0.2),"octave signal decay")
("perlin.numOctaves",po::value<int>()->default_value(6),"number of frequency octaves")
("perlin.xNoiseGen",po::value<int>()->default_value(683),"x direction noise generation seed")
("perlin.yNoiseGen",po::value<int>()->default_value(4933),"y direction noise generation seed")
("perlin.zNoiseGen",po::value<int>()->default_value(23),"z direction noise generation seed")
("perlin.seedNoiseGen",po::value<int>()->default_value(3095),"seed noise generation")
("perlin.shiftNoiseGen",po::value<int>()->default_value(11),"shift noise generation seed")
;
po::options_description boundaryOpt("Boundary noise options");
boundaryOpt.add_options()
("boundary.maxDeviation",po::value<double>()->default_value(0.25),"maximum perlin perturbation fraction of radius")
("boundary.frequency",po::value<double>()->default_value(0.2),"starting frequency")
("boundary.lacunarity",po::value<double>()->default_value(1.5),"octave frequency multiplier")
("boundary.persistence",po::value<double>()->default_value(0.5),"octave signal decay")
;
po::options_description perturbOpt("Lobule perturbation noise options");
perturbOpt.add_options()
("perturb.maxDeviation",po::value<double>()->default_value(0.25),"maximum perlin perturbation fraction of radius")
("perturb.frequency",po::value<double>()->default_value(0.2),"starting frequency")
("perturb.lacunarity",po::value<double>()->default_value(1.5),"octave frequency multiplier")
("perturb.persistence",po::value<double>()->default_value(0.5),"octave signal decay")
;
po::options_description bufferOpt("Lobule glandular buffer options");
bufferOpt.add_options()
("buffer.maxDeviation",po::value<double>()->default_value(0.1),"maximum perlin buffer fraction of radius")
("buffer.frequency",po::value<double>()->default_value(0.2),"starting frequency")
("buffer.lacunarity",po::value<double>()->default_value(1.5),"octave frequency multiplier")
("buffer.persistence",po::value<double>()->default_value(0.5),"octave signal decay")
;
po::options_description voronOpt("Voronoi options");
voronOpt.add_options()
("voronoi.fatInFatSeedDensity",po::value<double>()->default_value(0.0),"fat voronoi seed density (mm^-3)")
("voronoi.fatInGlandSeedDensity",po::value<double>()->default_value(0.0),"fat voronoi seed in glandular tissue density (mm^-3)")
("voronoi.glandInGlandSeedDensity",po::value<double>()->default_value(0.0),"glandular voronoi seed density (mm^-3)")
("voronoi.TDLUDeflectMax",po::value<double>()->default_value(0.0),"maximum deflection (fraction of pi)")
("voronoi.minScaleLenTDLU",po::value<double>()->default_value(0.0),"minimum length scale")
("voronoi.maxScaleLenTDLU",po::value<double>()->default_value(0.0),"maximum length scale")
("voronoi.minScaleWidTDLU",po::value<double>()->default_value(0.0),"minimum width scale")
("voronoi.maxScaleWidTDLU",po::value<double>()->default_value(0.0),"maximum width scale")
("voronoi.minStrTDLU",po::value<double>()->default_value(0.0),"minimum strength")
("voronoi.maxStrTDLU",po::value<double>()->default_value(0.0),"maximum strength")
("voronoi.fatInFatDeflectMax",po::value<double>()->default_value(0.15),"maximum deflection (fraction of pi)")
("voronoi.minScaleLenFatInFat",po::value<double>()->default_value(0.0),"minimum length scale")
("voronoi.maxScaleLenFatInFat",po::value<double>()->default_value(0.0),"maximum length scale")
("voronoi.minScaleWidFatInFat",po::value<double>()->default_value(0.0),"minimum width scale")
("voronoi.maxScaleWidFatInFat",po::value<double>()->default_value(0.0),"maximum width scale")
("voronoi.minStrFatInFat",po::value<double>()->default_value(0.0),"minimum strength")
("voronoi.maxStrFatInFat",po::value<double>()->default_value(0.0),"maximum strength")
("voronoi.fatInGlandDeflectMax",po::value<double>()->default_value(0.0),"maximum deflection (fraction of pi)")
("voronoi.minScaleLenFatInGland",po::value<double>()->default_value(0.0),"minimum length scale")
("voronoi.maxScaleLenFatInGland",po::value<double>()->default_value(0.0),"maximum length scale")
("voronoi.minScaleWidFatInGland",po::value<double>()->default_value(0.0),"minimum width scale")
("voronoi.maxScaleWidFatInGland",po::value<double>()->default_value(0.0),"maximum width scale")
("voronoi.minStrFatInGland",po::value<double>()->default_value(0.0),"minimum strength")
("voronoi.maxStrFatInGland",po::value<double>()->default_value(0.0),"maximum strength")
("voronoi.glandInGlandDeflectMax",po::value<double>()->default_value(0.0),"maximum deflection (fraction of pi)")
("voronoi.minScaleLenGlandInGland",po::value<double>()->default_value(0.0),"minimum length scale")
("voronoi.maxScaleLenGlandInGland",po::value<double>()->default_value(0.0),"maximum length scale")
("voronoi.minScaleWidGlandInGland",po::value<double>()->default_value(0.0),"minimum width scale")
("voronoi.maxScaleWidGlandInGland",po::value<double>()->default_value(0.0),"maximum width scale")
("voronoi.minStrGlandInGland",po::value<double>()->default_value(0.0),"minimum strength")
("voronoi.maxStrGlandInGland",po::value<double>()->default_value(0.0),"maximum strength")
("voronoi.seedRadius",po::value<double>()->default_value(10),"check seeds in radius (mm)")
;
po::options_description fatOpt("Fat lobule options");
fatOpt.add_options()
("fat.minLobuleAxis",po::value<double>()->default_value(7.0),"min lobule axis length (mm)")
("fat.maxLobuleAxis",po::value<double>()->default_value(12.0),"max lobule axis length (mm)")
("fat.minAxialRatio",po::value<double>()->default_value(0.33),"min axial ratio")
("fat.maxAxialRatio",po::value<double>()->default_value(0.53),"max axial ratio")
("fat.minLobuleGap",po::value<double>()->default_value(0.2),"minimum ligament separation between lobules")
("fat.maxCoeffStr",po::value<double>()->default_value(0.08),"maximum of absolute value of Fourier coefficient as fraction of main radius")
("fat.minCoeffStr",po::value<double>()->default_value(0.02),"minimum of absolute value of Fourier coefficient as fraction of main radius")
("fat.maxLobuleTry",po::value<int>()->default_value(600),"maximum number of trial lobules")
;
po::options_description ligOpt("Ligament options");
ligOpt.add_options()
("lig.thickness",po::value<double>()->default_value(0.12),"ligament thickness (mm)")
("lig.targetFrac",po::value<double>()->default_value(0.85),"ligamented volume stopping fraction")
("lig.maxTry",po::value<int>()->default_value(15000),"maximum number of ligaments")
("lig.minAxis",po::value<double>()->default_value(15.0),"min lobule axis length (mm)")
("lig.maxAxis",po::value<double>()->default_value(20.0),"max lobule axis length (mm)")
("lig.minAxialRatio",po::value<double>()->default_value(0.3),"min axial ratio")
("lig.maxAxialRatio",po::value<double>()->default_value(0.4),"max axial ratio")
("lig.maxPerturb",po::value<double>()->default_value(0.1),"maximum perlin perturbation fraction of radius")
("lig.maxDeflect",po::value<double>()->default_value(0.12),"maximum deflection from nipple direction (fraction of pi)")
("lig.scale",po::value<double>()->default_value(0.007),"perlin frequency scaling")
("lig.lacunarity",po::value<double>()->default_value(1.8),"octave frequency multiplier")
("lig.persistence",po::value<double>()->default_value(0.6),"octave signal decay")
("lig.numOctaves",po::value<int>()->default_value(6),"number of frequency octaves")
;
po::options_description ductTreeOpt("Duct tree options");
ductTreeOpt.add_options()
("ductTree.maxBranch",po::value<uint>()->default_value(100),"Maximum number of branches")
("ductTree.maxGen",po::value<uint>()->default_value(15),"Maximum generation")
("ductTree.baseLength",po::value<double>()->default_value(7.6),"main branch length (mm)")
("ductTree.initRad",po::value<double>()->default_value(2.0),"tree start radius")
("ductTree.nFillX",po::value<uint>()->default_value(100),"number x voxels for density map")
("ductTree.nFillY",po::value<uint>()->default_value(100),"number y voxels for density map")
("ductTree.nFillZ",po::value<uint>()->default_value(100),"number z voxels for density map")
;
po::options_description ductBrOpt("Duct Branch options");
ductBrOpt.add_options()
("ductBr.childMinRad",po::value<double>()->default_value(0.25),"min radius to have children")
("ductBr.minRadFrac",po::value<double>()->default_value(0.65),"min start radius as fraction of parent radius")
("ductBr.maxRadFrac",po::value<double>()->default_value(0.99),"max start radius as fraction of parent radius")
("ductBr.lenShrink",po::value<double>()->default_value(0.5),"duct length relative to parent")
("ductBr.lenRange",po::value<double>()->default_value(0.1),"duct length fraction variability")
("ductBr.rotateJitter",po::value<double>()->default_value(0.1),"jitter in azimuthal angle of second child")
;
po::options_description ductSegOpt("Duct Segment options");
ductSegOpt.add_options()
("ductSeg.radiusBetaA",po::value<double>()->default_value(2.0),"radius distribution shape parameter A")
("ductSeg.radiusBetaB",po::value<double>()->default_value(2.0),"radius distribution shape parameter B")
("ductSeg.maxCurvRad",po::value<double>()->default_value(20.0),"max radius of curvature")
("ductSeg.maxCurvFrac",po::value<double>()->default_value(0.33),"max fraction of circle")
("ductSeg.minEndRad",po::value<double>()->default_value(0.85),"min end radius as fraction of start radius")
("ductSeg.maxEndRad",po::value<double>()->default_value(1.05),"max end radius as fraction of start radius")
("ductSeg.angleWt",po::value<double>()->default_value(1.0),"cost function preferential angle weighting")
("ductSeg.densityWt",po::value<double>()->default_value(5e-5),"cost function density weighting")
("ductSeg.numTry",po::value<uint>()->default_value(10),"number of trial segments")
("ductSeg.maxTry",po::value<uint>()->default_value(100),"max number of trial segments before reducing length")
("ductSeg.absMaxTry",po::value<uint>()->default_value(10000),"max number of trial segments before completely giving up")
// check if this needs to be changed
("ductSeg.roiStep",po::value<double>()->default_value(0.1),"step size for checking segment validity")
("ductSeg.segFrac",po::value<double>()->default_value(0.25),"fraction of branch length per segment")
;
/* ==========================================================================================
Modifications were made in Lines 277 and 278 by Seonyeong Park to improve blood vasculature
modeling for use in optical and optoacoustic imaging.
Reference:
Seonyeong Park, Umberto Villa, Fu Li, Refik Mert Cam, Alexander A. Oraevsky, Mark A.
Anastasio, "Stochastic three-dimensional numerical phantoms to enable computational studies
in quantitative optoacoustic computed tomography of breast cancer," J. Biomed. Opt. 28(6)
066002 (20 June 2023) https://doi.org/10.1117/1.JBO.28.6.066002
========================================================================================== */
po::options_description vesselTreeOpt("Vessel tree options");
vesselTreeOpt.add_options()
("vesselTree.maxBranch",po::value<uint>()->default_value(100),"Maximum number of branches")
("vesselTree.maxGen",po::value<uint>()->default_value(15),"Maximum generation")
("vesselTree.baseLength",po::value<double>()->default_value(12.0),"main branch length (mm)")
("vesselTree.initRad",po::value<double>()->default_value(2.0),"tree start radius")
("vesselTree.nFillX",po::value<uint>()->default_value(100),"number x voxels for density map")
("vesselTree.nFillY",po::value<uint>()->default_value(100),"number y voxels for density map")
("vesselTree.nFillZ",po::value<uint>()->default_value(100),"number z voxels for density map")
("vesselTree.vesselEdgeSep1", po::value<double>()->default_value(2), "distance from edge of breast of vessel entry point (mm)")
("vesselTree.vesselEdgeSep2", po::value<double>()->default_value(24), "distance from edge of breast of vessel entry point (mm)");
;
po::options_description vesselBrOpt("Vessel branch options");
vesselBrOpt.add_options()
("vesselBr.childMinRad",po::value<double>()->default_value(0.25),"min radius to have children")
("vesselBr.minRadFrac",po::value<double>()->default_value(0.6),"min start radius as fraction of parent radius")
("vesselBr.maxRadFrac",po::value<double>()->default_value(0.85),"max start radius as fraction of parent radius")
("vesselBr.lenShrink",po::value<double>()->default_value(0.5),"mean vessel length relative to parent")
("vesselBr.lenRange",po::value<double>()->default_value(0.1),"vessel length fraction variability")
("vesselBr.rotateJitter",po::value<double>()->default_value(0.1),"jitter in azimuthal angle of second child")
;
po::options_description vesselSegOpt("Vessel segment options");
vesselSegOpt.add_options()
("vesselSeg.radiusBetaA",po::value<double>()->default_value(2.0),"radius distribution shape parameter A")
("vesselSeg.radiusBetaB",po::value<double>()->default_value(2.0),"radius distribution shape parameter B")
("vesselSeg.maxCurvRad",po::value<double>()->default_value(20.0),"max radius of curvature")
("vesselSeg.maxCurvFrac",po::value<double>()->default_value(0.33),"max fraction of circle")
("vesselSeg.minEndRad",po::value<double>()->default_value(0.85),"min end radius as fraction of start radius")
("vesselSeg.maxEndRad",po::value<double>()->default_value(1.05),"max end radius as fraction of start radius")
("vesselSeg.angleWt",po::value<double>()->default_value(1.0),"cost function preferential angle weighting")
("vesselSeg.densityWt",po::value<double>()->default_value(5e-5),"cost function density weighting")
("vesselSeg.dirWt",po::value<double>()->default_value(5e-5),"cost function direction weighting")
("vesselSeg.numTry",po::value<uint>()->default_value(10),"number of trial segments")
("vesselSeg.maxTry",po::value<uint>()->default_value(100),"max number of trial segments before reducing length")
("vesselSeg.absMaxTry",po::value<uint>()->default_value(10000),"max number of trial segments before completely giving up")
// check if this needs to be changed
("vesselSeg.roiStep",po::value<double>()->default_value(0.1),"step size for checking segment validity")
("vesselSeg.segFrac",po::value<double>()->default_value(0.25),"fraction of branch length per segment")
;
// config file options
po::options_description configFileOpt("Configuration file options");
configFileOpt.add(baseOpt).add(shapeOpt);
configFileOpt.add(ductTreeOpt).add(ductBrOpt).add(ductSegOpt);
configFileOpt.add(vesselTreeOpt).add(vesselBrOpt).add(vesselSegOpt);
configFileOpt.add(compartOpt).add(TDLUOpt).add(fatOpt);
configFileOpt.add(voronOpt).add(perlinOpt).add(boundaryOpt);
configFileOpt.add(bufferOpt).add(perturbOpt).add(ligOpt);
// all of the options
po::options_description all("All options");
all.add_options()
("config,c", po::value<std::string>()->required(), "name of configuration file")
;
all.add(configFileOpt);
po::variables_map vm;
// get configuration filename from command line
po::store(parse_command_line(argc,argv,all), vm);
std::string configFile = vm["config"].as<std::string>();
// read configuration file
ifstream inConfig(configFile.c_str());
if(!inConfig){
cout << "Can not open configuration file: " << configFile << "\n";
return(1);
} else {
po::store(parse_config_file(inConfig, configFileOpt), vm);
inConfig.close();
};
// load resolution variables
double ures = vm["shape.ures"].as<double>(); // spacing in u-v space
double vres = vm["shape.vres"].as<double>();
double pointSep = vm["shape.pointSep"].as<double>(); // remove close points
double featureAngle = vm["shape.featureAngle"].as<double>(); // angle to preserve when smoothing
double targetReduction = vm["shape.targetReduction"].as<double>(); // fraction of triangles to decimate
double imgRes = vm["base.imgRes"].as<double>(); // size of image voxels (mm)
double skinThick = vm["base.skinThick"].as<double>(); // thickness of skin (mm)
std::string breastVoxelFilename = "breastVoxel.vti";
char outVTIFilename[128];
char outhdrFilename[128];
char outgzFilename[128];
double scaleFactor = 35.0; // scale voxel size to millimeters
double nippleLen = vm["base.nippleLen"].as<double>(); // length of nipple (mm)
double nippleRad = vm["base.nippleRad"].as<double>(); // radius of nipple (mm)
double areolaRad = vm["base.areolaRad"].as<double>(); // radius of areola (mm)
double voxelVol = imgRes*imgRes*imgRes; // volume of a voxel (cubic mm)
tissueStruct tissue;
tissue.bg = 0;
tissue.skin = 2;
tissue.nipple = 33;
tissue.fat = 1;
tissue.cooper = 88;
tissue.gland = 29;
tissue.TDLU = 95;
tissue.duct = 125;
tissue.artery = 150;
tissue.vein = 225 ;
tissue.muscle = 40;
const unsigned char glandBuffer = 222;
const unsigned char innerVal = 175; // not needed after compartment creation
const unsigned char boundVal = 50; // edge of inner breast volume, not needed after skin generation
const unsigned char compartmentVal[20] = {12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28};
const unsigned char compMax = 28; // max compartment value for cooper's ligament
const unsigned char compMin = 12;
// unligamented tissue classes
const unsigned char ufat = 60;
const unsigned char ugland = 61;
const unsigned char uTDLU = 62;
const unsigned char uduct = 63;
// random number generator seed
// use seed specified in config file, otherwise random seed
int randSeed;
if(vm.count("base.seed")){
// seed specified in configuration file
randSeed = vm["base.seed"].as<unsigned int>();
} else {
// generate random seed
FILE *randFile;
randFile = fopen("/dev/urandom","r");
size_t fread_out;
fread_out = fread((char*)(&randSeed), sizeof(int),1,randFile);
fclose(randFile);
}
// output base directory
std::string outputDir = vm["base.outputDir"].as<std::string>();
// exists?
if(access(outputDir.c_str(),F_OK)){
// directory doesn't exist
// try to create it
if(mkdir(outputDir.c_str(),S_IRWXU) == -1){
// couldn't create directory
cerr << "Could not create directory " << outputDir << "\n";
cerr << "Exiting...\n";
return(1);
}
}
// is it a directory?
struct stat fileInfo;
stat(outputDir.c_str(), &fileInfo);
if(S_ISDIR(fileInfo.st_mode)){
// it's a directory
// make it the working directory
if(chdir(outputDir.c_str()) == -1){
cerr << "Could not access directory " << outputDir << "\n";
cerr << "Exiting...\n";
return(1);
}
} else {
// error, not a directory
cerr << "Specified path is not a valid directory\n";
cerr << "Exiting...\n";
return(1);
}
// copy over config file
char cfgOutFilename[128];
sprintf(cfgOutFilename,"%s/p_%d.cfg", outputDir.c_str(),randSeed);
FILE *cfgCopy = fopen(cfgOutFilename,"wt");
FILE *cfgRead = fopen(configFile.c_str(),"rt");
int readChar = getc(cfgRead);
while(readChar != EOF){
putc(readChar, cfgCopy);
readChar = getc(cfgRead);
}
fclose(cfgCopy);
fclose(cfgRead);
sprintf(outVTIFilename,"%s/p_%d.vti", outputDir.c_str(),randSeed);
//sprintf(outrawFilename,"%s/p_%d.zraw", outputDir.c_str(),randSeed);
sprintf(outhdrFilename,"%s/p_%d.mhd", outputDir.c_str(),randSeed);
sprintf(outgzFilename,"%s/p_%d.raw.gz", outputDir.c_str(),randSeed);
// shape parameters
// base shape coefficients
double a1b = vm["shape.a1b"].as<double>();
double a1t = vm["shape.a1t"].as<double>();
double a2l = vm["shape.a2l"].as<double>();
double a2r = vm["shape.a2r"].as<double>();
double a3 = vm["shape.a3"].as<double>();
double eps1 = vm["shape.eps1"].as<double>();
double eps2 = vm["shape.eps2"].as<double>();
// breast side
bool leftSide = vm["base.leftBreast"].as<bool>();
// ptosis parameters
bool doPtosis = vm["shape.doPtosis"].as<bool>();
double b0 = vm["shape.ptosisB0"].as<double>();
double b1 = vm["shape.ptosisB1"].as<double>();
// turn parameters
bool doTurn = vm["shape.doTurn"].as<bool>();
double c0 = vm["shape.turnC0"].as<double>();
double c1 = vm["shape.turnC1"].as<double>();
// top shape parameters
bool doTopShape = vm["shape.doTopShape"].as<bool>();
double s0 = vm["shape.topShapeS0"].as<double>();
double t0 = vm["shape.topShapeT0"].as<double>();
double s1 = vm["shape.topShapeS1"].as<double>();
double t1 = vm["shape.topShapeT1"].as<double>();
// derived top shape parameters
double At = -0.5*t0-3.0*s0-3.0*s1+0.5*t1;
double Bt = 1.5*t0+8.0*s0+7.0*s1-t1;
double Ct = -1.5*t0-6.0*s0-4.0*s1+0.5*t1;
double Dt = 0.5*t0;
double Et = s0;
double Ft = 1.0;
// flatten side parameters
bool doFlattenSide = vm["shape.doFlattenSide"].as<bool>();
double g0 = vm["shape.flattenSideG0"].as<double>();
double g1 = vm["shape.flattenSideG1"].as<double>();
// derived parameters for flatten side
double Af = g1+2.0-2.0*g0;
double Bf = -g1-3.0+3.0*g0;
double Cf = 0.0;
double Df = 1.0;
// turn top parameters
bool doTurnTop = vm["shape.doTurnTop"].as<bool>();
double h0 = vm["shape.turnTopH0"].as<double>();
double h1 = vm["shape.turnTopH1"].as<double>();
// start a random number generator
vtkSmartPointer<vtkMinimalStandardRandomSequence> rgen =
vtkSmartPointer<vtkMinimalStandardRandomSequence>::New();
rgen->SetSeed(randSeed);
/***********************
Shape
***********************/
// create base shape
// point positions
double uval,vval,xval,yval,zval;
vtkIdType myId;
vtkSmartPointer<vtkPoints> brightFront =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> brightBack =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> brightRing =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> trightFront =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> trightBack =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> trightRing =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> tleftFront =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> tleftBack =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> tleftRing =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> bleftFront =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> bleftBack =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> bleftRing =
vtkSmartPointer<vtkPoints>::New();
vtkIdType centerPt;
#pragma omp sections private(uval,vval,xval,yval,zval,myId)
{
#pragma omp section
{
// bottom right breast
vval = -1.0*pi + vres;
while(vval <= -0.5*pi){
uval = 0.0;
// ring is uval == 0
xval = 0.0;
yval = pow(a2r,eps1)*pow(sin(vval),eps2);
zval = pow(a1b,eps1)*pow(cos(vval),eps2);
myId = brightRing->InsertNextPoint(xval,yval,zval);
uval += ures;
while(uval <= 0.5*pi){
xval = pow(a3*sin(uval),eps1);
yval = pow(a2r*cos(uval),eps1)*pow(sin(vval),eps2);
zval = pow(a1b*cos(uval),eps1)*pow(cos(vval),eps2);
// add point to front
myId = brightFront->InsertNextPoint(xval,yval,zval);
// add backplane point
myId = brightBack->InsertNextPoint(0.0,yval,zval);
uval += ures;
}
vval += vres;
}
// add center point to bottom-right breast front and back and skip
centerPt = brightFront->InsertNextPoint(pow(a3,eps1),0.0,0.0);
centerPt = brightBack->InsertNextPoint(0.0,0.0,0.0);
}
#pragma omp section
{
// top right breast
vval = -0.5*pi + vres;
while(vval <= 0.0){
uval = 0.0;
xval = 0.0;
yval = pow(a2r,eps1)*pow(sin(vval),eps2);
zval = pow(a1t,eps1)*pow(cos(vval),eps2);
myId = trightRing->InsertNextPoint(xval,yval,zval);
uval += ures;
while(uval <= 0.5*pi){
xval = pow(a3*sin(uval),eps1);
yval = pow(a2r*cos(uval),eps1)*pow(sin(vval),eps2);
zval = pow(a1t*cos(uval),eps1)*pow(cos(vval),eps2);
// add the point
myId = trightFront->InsertNextPoint(xval,yval,zval);
// add backplane point
myId = trightBack->InsertNextPoint(0.0,yval,zval);
uval += ures;
}
vval += vres;
}
}
#pragma omp section
{
// top left breast
vval = 0.0 + vres;
while(vval <= 0.5*pi){
uval = 0.0;
xval = 0.0;
yval = pow(a2l,eps1)*pow(sin(vval),eps2);
zval = pow(a1t,eps1)*pow(cos(vval),eps2);
myId = tleftRing->InsertNextPoint(xval,yval,zval);
uval += ures;
while(uval <= 0.5*pi){
xval = pow(a3*sin(uval),eps1);
yval = pow(a2l*cos(uval),eps1)*pow(sin(vval),eps2);
zval = pow(a1t*cos(uval),eps1)*pow(cos(vval),eps2);
// add the point
myId = tleftFront->InsertNextPoint(xval,yval,zval);
// add backplane point
myId = tleftBack->InsertNextPoint(0.0,yval,zval);
uval += ures;
}
vval += vres;
}
}
#pragma omp section
{
// bottom left breast
vval = 0.5*pi + vres;
while(vval <= pi){
uval = 0.0;
xval = 0.0;
yval = pow(a2l,eps1)*pow(sin(vval),eps2);
zval = pow(a1b,eps1)*pow(cos(vval),eps2);
myId = bleftRing->InsertNextPoint(xval,yval,zval);
uval += ures;
while(uval <= 0.5*pi){
xval = pow(a3*sin(uval),eps1);
yval = pow(a2l*cos(uval),eps1)*pow(sin(vval),eps2);
zval = pow(a1b*cos(uval),eps1)*pow(cos(vval),eps2);
// add the point
myId = bleftFront->InsertNextPoint(xval,yval,zval);
// add backplane point
myId = bleftBack->InsertNextPoint(0.0,yval,zval);
uval += ures;
}
vval += vres;
}
}
} // end omp sections
// have base shape
// do deformations
// top shape
if(doTopShape){
vtkIdType npts = trightFront->GetNumberOfPoints();
uval = ures; // need original u value
for(int i=0; i<npts; i++){
double pval[3];
double u2 = uval*2.0/pi;
// front
trightFront->GetPoint(i, pval);
pval[2] = pval[2]*(At*pow(u2,5.0)+Bt*pow(u2,4.0)+
Ct*pow(u2,3.0)+Dt*u2*u2+Et*u2+Ft);
trightFront->SetPoint(i,pval);
// back
trightBack->GetPoint(i, pval);
pval[2] = pval[2]*(At*pow(u2,5.0)+Bt*pow(u2,4.0)+
Ct*pow(u2,3.0)+Dt*u2*u2+Et*u2+Ft);
trightBack->SetPoint(i,pval);
uval += ures;
if(uval > 0.5*pi){
uval = ures;
}
}
// ring
npts = trightRing->GetNumberOfPoints();
for(int i=0; i<npts; i++){
double pval[3];
trightRing->GetPoint(i, pval);
pval[2] = pval[2]*Ft;
trightRing->SetPoint(i,pval);
}
npts = tleftFront->GetNumberOfPoints();
uval = ures; // need original u value
for(int i=0; i<npts; i++){
double pval[3];
double u2 = uval*2.0/pi;
// front
tleftFront->GetPoint(i, pval);
pval[2] = pval[2]*(At*pow(u2,5.0)+Bt*pow(u2,4.0)+
Ct*pow(u2,3.0)+Dt*u2*u2+Et*u2+Ft);
tleftFront->SetPoint(i,pval);
// back
tleftBack->GetPoint(i, pval);
pval[2] = pval[2]*(At*pow(u2,5.0)+Bt*pow(u2,4.0)+
Ct*pow(u2,3.0)+Dt*u2*u2+Et*u2+Ft);
tleftBack->SetPoint(i,pval);
uval += ures;
if(uval > 0.5*pi){
uval = ures;
}
}
// ring
npts = tleftRing->GetNumberOfPoints();
for(int i=0; i<npts; i++){
double pval[3];
tleftRing->GetPoint(i, pval);
pval[2] = pval[2]*Ft;
tleftRing->SetPoint(i,pval);
}
}
// flatten side
if(doFlattenSide){
if(leftSide){
trightFront->ComputeBounds();
double bound[6];
trightFront->GetBounds(bound);
double scale;
if(fabs(bound[2]) > fabs(bound[3])){
scale = fabs(bound[2]);
} else {
scale = fabs(bound[3]);
}
vtkIdType npts = trightFront->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
// front
trightFront->GetPoint(i,pval);
double yv = fabs(pval[1]/scale);
pval[1] = pval[1]*(Af*yv*yv*yv + Bf*yv*yv +
Cf*yv + Df);
trightFront->SetPoint(i,pval);
// back
trightBack->GetPoint(i,pval);
yv = fabs(pval[1]/scale);
pval[1] = pval[1]*(Af*yv*yv*yv + Bf*yv*yv +
Cf*yv + Df);
trightBack->SetPoint(i,pval);
}
// ring
npts = trightRing->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
trightRing->GetPoint(i,pval);
double yv = fabs(pval[1]/scale);
pval[1] = pval[1]*(Af*yv*yv*yv + Bf*yv*yv +
Cf*yv + Df);
trightRing->SetPoint(i,pval);
}
brightFront->ComputeBounds();
brightFront->GetBounds(bound);
if(fabs(bound[2]) > fabs(bound[3])){
scale = fabs(bound[2]);
} else {
scale = fabs(bound[3]);
}
npts = brightFront->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
//front
brightFront->GetPoint(i,pval);
double yv = fabs(pval[1]/scale);
pval[1] = pval[1]*(Af*yv*yv*yv + Bf*yv*yv +
Cf*yv + Df);
brightFront->SetPoint(i,pval);
// back
brightBack->GetPoint(i,pval);
yv = fabs(pval[1]/scale);
pval[1] = pval[1]*(Af*yv*yv*yv + Bf*yv*yv +
Cf*yv + Df);
brightBack->SetPoint(i,pval);
}
// ring
npts = brightRing->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
brightRing->GetPoint(i,pval);
double yv = fabs(pval[1]/scale);
pval[1] = pval[1]*(Af*yv*yv*yv + Bf*yv*yv +
Cf*yv + Df);
brightRing->SetPoint(i,pval);
}
} else {
// right side
tleftFront->ComputeBounds();
double bound[6];
tleftFront->GetBounds(bound);
double scale;
if(fabs(bound[2]) > fabs(bound[3])){
scale = fabs(bound[2]);
} else {
scale = fabs(bound[3]);
}
vtkIdType npts = tleftFront->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
// front
tleftFront->GetPoint(i,pval);
double yv = fabs(pval[1]/scale);
pval[1] = pval[1]*(Af*yv*yv*yv + Bf*yv*yv +
Cf*yv + Df);
tleftFront->SetPoint(i,pval);
// back
tleftBack->GetPoint(i,pval);
yv = fabs(pval[1]/scale);
pval[1] = pval[1]*(Af*yv*yv*yv + Bf*yv*yv +
Cf*yv + Df);
tleftBack->SetPoint(i,pval);
}
// ring
npts = tleftRing->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
tleftRing->GetPoint(i,pval);
double yv = fabs(pval[1]/scale);
pval[1] = pval[1]*(Af*yv*yv*yv + Bf*yv*yv +
Cf*yv + Df);
tleftRing->SetPoint(i,pval);
}
bleftFront->ComputeBounds();
bleftFront->GetBounds(bound);
if(fabs(bound[2]) > fabs(bound[3])){
scale = fabs(bound[2]);
} else {
scale = fabs(bound[3]);
}
npts = bleftFront->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
// front
bleftFront->GetPoint(i,pval);
double yv = fabs(pval[1]/scale);
pval[1] = pval[1]*(Af*yv*yv*yv + Bf*yv*yv +
Cf*yv + Df);
bleftFront->SetPoint(i,pval);
// back
bleftBack->GetPoint(i,pval);
yv = fabs(pval[1]/scale);
pval[1] = pval[1]*(Af*yv*yv*yv + Bf*yv*yv +
Cf*yv + Df);
bleftBack->SetPoint(i,pval);
}
// ring
npts = bleftRing->GetNumberOfPoints();
//#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
bleftRing->GetPoint(i,pval);
double yv = fabs(pval[1]/scale);
pval[1] = pval[1]*(Af*yv*yv*yv + Bf*yv*yv +
Cf*yv + Df);
bleftRing->SetPoint(i,pval);
}
}
}
// turn top
if(doTurnTop){
trightFront->ComputeBounds();
double bound[6];
trightFront->GetBounds(bound);
double scale;
if(fabs(bound[4]) > fabs(bound[5])){
scale = fabs(bound[4]);
} else {
scale = fabs(bound[5]);
}
vtkIdType npts = trightFront->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
// front
trightFront->GetPoint(i,pval);
pval[1] = pval[1] - h0*pval[2]/scale -
h1*pval[2]*pval[2]/scale/scale;
trightFront->SetPoint(i,pval);
// back
trightBack->GetPoint(i,pval);
pval[1] = pval[1] - h0*pval[2]/scale -
h1*pval[2]*pval[2]/scale/scale;
trightBack->SetPoint(i,pval);
}
// ring
npts = trightRing->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
trightRing->GetPoint(i,pval);
pval[1] = pval[1] - h0*pval[2]/scale -
h1*pval[2]*pval[2]/scale/scale;
trightRing->SetPoint(i,pval);
}
tleftFront->ComputeBounds();
tleftFront->GetBounds(bound);
if(fabs(bound[4]) > fabs(bound[5])){
scale = fabs(bound[4]);
} else {
scale = fabs(bound[5]);
}
npts = tleftFront->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
// front
tleftFront->GetPoint(i,pval);
pval[1] = pval[1] - h0*pval[2]/scale -
h1*pval[2]*pval[2]/scale/scale;
tleftFront->SetPoint(i,pval);
// back
tleftBack->GetPoint(i,pval);
pval[1] = pval[1] - h0*pval[2]/scale -
h1*pval[2]*pval[2]/scale/scale;
tleftBack->SetPoint(i,pval);
}
// ring
npts = tleftRing->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
tleftRing->GetPoint(i,pval);
pval[1] = pval[1] - h0*pval[2]/scale -
h1*pval[2]*pval[2]/scale/scale;
tleftRing->SetPoint(i,pval);
}
}
// ptosis
if(doPtosis){
vtkIdType npts = trightFront->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
// front
trightFront->GetPoint(i,pval);
pval[2] = pval[2] - (b0*pval[0] + b1*pval[0]*pval[0]);
trightFront->SetPoint(i,pval);
// back
trightBack->GetPoint(i,pval);
pval[2] = pval[2] - (b0*pval[0] + b1*pval[0]*pval[0]);
trightBack->SetPoint(i,pval);
}
// ring
npts = trightRing->GetNumberOfPoints();
#pragma omp parallel for
for(int i=0; i<npts; i++){
double pval[3];
trightRing->GetPoint(i,pval);
pval[2] = pval[2] - (b0*pval[0] + b1*pval[0]*pval[0]);
trightRing->SetPoint(i,pval);
}