Skip to content

Commit ea88d55

Browse files
committed
Adding an example of manipulating a DREAM.3D pipeline file through loading
the JSON representation into a QJsonDocument, editing the value of interest and writing the JSON back out to a new file.
1 parent 2a279c2 commit ea88d55

File tree

6 files changed

+586
-1
lines changed

6 files changed

+586
-1
lines changed

Source/Plugins/StatsGenerator/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,9 @@ if(DREAM3D_BUILD_TESTING)
280280
include(${${PLUGIN_NAME}_SOURCE_DIR}/Test/CMakeLists.txt)
281281
endif()
282282

283+
set(BUILD_EXAMPLES ON)
284+
if(BUILD_EXAMPLES)
285+
include(${${PLUGIN_NAME}_SOURCE_DIR}/Examples/Examples.cmake)
286+
endif()
287+
283288

Lines changed: 303 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,303 @@
1+
{
2+
"0": {
3+
"CellEnsembleAttributeMatrixName": "CellEnsembleData",
4+
"CrystalStructuresArrayName": "CrystalStructures",
5+
"Filter_Human_Label": "StatsGenerator",
6+
"Filter_Name": "StatsGeneratorFilter",
7+
"PhaseTypesArrayName": "PhaseTypes",
8+
"StatsDataArray": {
9+
"1": {
10+
"AxisODF-Weights": {
11+
},
12+
"Bin Count": 6,
13+
"BinNumber": [
14+
1.6487212181091309,
15+
2.1487212181091309,
16+
2.6487212181091309,
17+
3.1487212181091309,
18+
3.6487212181091309,
19+
4.1487212181091309
20+
],
21+
"BoundaryArea": -3.9023563200400863e+26,
22+
"Crystal Symmetry": 1,
23+
"FeatureSize Distribution": {
24+
"Average": 1,
25+
"Standard Deviation": 0.10000000149011612
26+
},
27+
"FeatureSize Vs B Over A Distributions": {
28+
"Alpha": [
29+
15.670198440551758,
30+
15.990322113037109,
31+
15.42994213104248,
32+
15.664474487304688,
33+
15.813533782958984,
34+
15.063400268554688
35+
],
36+
"Beta": [
37+
1.4745615720748901,
38+
1.3117260932922363,
39+
1.4306083917617798,
40+
1.319675087928772,
41+
1.4285726547241211,
42+
1.6723227500915527
43+
],
44+
"Distribution Type": "Beta Distribution"
45+
},
46+
"FeatureSize Vs C Over A Distributions": {
47+
"Alpha": [
48+
15.888378143310547,
49+
15.88770866394043,
50+
15.31517219543457,
51+
15.294156074523926,
52+
15.484362602233887,
53+
15.312053680419922
54+
],
55+
"Beta": [
56+
1.3222322463989258,
57+
1.4461191892623901,
58+
1.2737034559249878,
59+
1.558407187461853,
60+
1.4442061185836792,
61+
1.515973687171936
62+
],
63+
"Distribution Type": "Beta Distribution"
64+
},
65+
"FeatureSize Vs Neighbors Distributions": {
66+
"Average": [
67+
2.0794415473937988,
68+
2.3025851249694824,
69+
2.4849066734313965,
70+
2.6390573978424072,
71+
2.7725887298583984,
72+
2.8903717994689941
73+
],
74+
"Distribution Type": "Log Normal Distribution",
75+
"Standard Deviation": [
76+
0.40000000596046448,
77+
0.36666667461395264,
78+
0.3333333432674408,
79+
0.30000001192092896,
80+
0.26666665077209473,
81+
0.23333333432674408
82+
]
83+
},
84+
"FeatureSize Vs Omega3 Distributions": {
85+
"Alpha": [
86+
10.07761287689209,
87+
10.853179931640625,
88+
10.954100608825684,
89+
10.597855567932129,
90+
10.099923133850098,
91+
10.510183334350586
92+
],
93+
"Beta": [
94+
1.7247488498687744,
95+
1.5753319263458252,
96+
1.7001838684082031,
97+
1.7066255807876587,
98+
1.9831211566925049,
99+
1.5457489490509033
100+
],
101+
"Distribution Type": "Beta Distribution"
102+
},
103+
"Feature_Diameter_Info": [
104+
0.5,
105+
4.4816889762878418,
106+
1.6487212181091309
107+
],
108+
"MDF-Weights": {
109+
},
110+
"ODF-Weights": {
111+
},
112+
"PhaseFraction": 1,
113+
"PhaseType": "Primary"
114+
},
115+
"Name": "Statistics",
116+
"Phase Count": 2
117+
},
118+
"StatsDataArrayName": "Statistics",
119+
"StatsGeneratorDataContainerName": "StatsGeneratorDataContainer"
120+
},
121+
"1": {
122+
"CellAttributeMatrixName": "CellData",
123+
"DataContainerName": "SyntheticVolumeDataContainer",
124+
"Dimensions": {
125+
"x": 128,
126+
"y": 128,
127+
"z": 128
128+
},
129+
"EstimateNumberOfFeatures": 1,
130+
"FilterVersion": "1.0.152",
131+
"Filter_Human_Label": "Initialize Synthetic Volume",
132+
"Filter_Name": "InitializeSyntheticVolume",
133+
"InputPhaseTypesArrayPath": {
134+
"Attribute Matrix Name": "CellEnsembleData",
135+
"Data Array Name": "PhaseTypes",
136+
"Data Container Name": "StatsGeneratorDataContainer"
137+
},
138+
"InputStatsArrayPath": {
139+
"Attribute Matrix Name": "CellEnsembleData",
140+
"Data Array Name": "Statistics",
141+
"Data Container Name": "StatsGeneratorDataContainer"
142+
},
143+
"InputStatsFile": "",
144+
"Origin": {
145+
"x": 0,
146+
"y": 0,
147+
"z": 0
148+
},
149+
"Resolution": {
150+
"x": 0.25,
151+
"y": 0.25,
152+
"z": 0.25
153+
}
154+
},
155+
"2": {
156+
"FilterVersion": "1.0.152",
157+
"Filter_Human_Label": "Establish Shape Types",
158+
"Filter_Name": "EstablishShapeTypes",
159+
"InputPhaseTypesArrayPath": {
160+
"Attribute Matrix Name": "CellEnsembleData",
161+
"Data Array Name": "PhaseTypes",
162+
"Data Container Name": "StatsGeneratorDataContainer"
163+
},
164+
"ShapeTypeData": [
165+
999,
166+
0
167+
],
168+
"ShapeTypesArrayName": "ShapeTypes"
169+
},
170+
"3": {
171+
"CellPhasesArrayName": "Phases",
172+
"CsvOutputFile": "",
173+
"ErrorOutputFile": "",
174+
"FeatureIdsArrayName": "FeatureIds",
175+
"FeatureInputFile": "",
176+
"FeaturePhasesArrayName": "Phases",
177+
"FilterVersion": "1.0.152",
178+
"Filter_Human_Label": "Pack Primary Phases",
179+
"Filter_Name": "PackPrimaryPhases",
180+
"HaveFeatures": 0,
181+
"InputPhaseTypesArrayPath": {
182+
"Attribute Matrix Name": "CellEnsembleData",
183+
"Data Array Name": "PhaseTypes",
184+
"Data Container Name": "StatsGeneratorDataContainer"
185+
},
186+
"InputShapeTypesArrayPath": {
187+
"Attribute Matrix Name": "CellEnsembleData",
188+
"Data Array Name": "ShapeTypes",
189+
"Data Container Name": "StatsGeneratorDataContainer"
190+
},
191+
"InputStatsArrayPath": {
192+
"Attribute Matrix Name": "CellEnsembleData",
193+
"Data Array Name": "Statistics",
194+
"Data Container Name": "StatsGeneratorDataContainer"
195+
},
196+
"MaskArrayPath": {
197+
"Attribute Matrix Name": "",
198+
"Data Array Name": "",
199+
"Data Container Name": ""
200+
},
201+
"NumFeaturesArrayName": "NumFeatures",
202+
"OutputCellAttributeMatrixPath": {
203+
"Attribute Matrix Name": "CellData",
204+
"Data Array Name": "",
205+
"Data Container Name": "SyntheticVolumeDataContainer"
206+
},
207+
"OutputCellEnsembleAttributeMatrixName": "CellEnsembleData",
208+
"OutputCellFeatureAttributeMatrixName": "CellFeatureData",
209+
"PeriodicBoundaries": 0,
210+
"UseMask": 0,
211+
"VtkOutputFile": "",
212+
"WriteGoalAttributes": 0
213+
},
214+
"4": {
215+
"BoundaryCellsArrayName": "BoundaryCells",
216+
"CellFeatureAttributeMatrixPath": {
217+
"Attribute Matrix Name": "CellFeatureData",
218+
"Data Array Name": "",
219+
"Data Container Name": "SyntheticVolumeDataContainer"
220+
},
221+
"FeatureIdsArrayPath": {
222+
"Attribute Matrix Name": "CellData",
223+
"Data Array Name": "FeatureIds",
224+
"Data Container Name": "SyntheticVolumeDataContainer"
225+
},
226+
"FilterVersion": "1.0.152",
227+
"Filter_Human_Label": "Find Feature Neighbors",
228+
"Filter_Name": "FindNeighbors",
229+
"NeighborListArrayName": "NeighborList",
230+
"NumNeighborsArrayName": "NumNeighbors",
231+
"SharedSurfaceAreaListArrayName": "SharedSurfaceAreaList",
232+
"StoreBoundaryCells": 1,
233+
"StoreSurfaceFeatures": 1,
234+
"SurfaceFeaturesArrayName": "SurfaceFeatures"
235+
},
236+
"5": {
237+
"AvgQuatsArrayName": "AvgQuats",
238+
"CellEulerAnglesArrayName": "EulerAngles",
239+
"CrystalStructuresArrayPath": {
240+
"Attribute Matrix Name": "CellEnsembleData",
241+
"Data Array Name": "CrystalStructures",
242+
"Data Container Name": "StatsGeneratorDataContainer"
243+
},
244+
"FeatureEulerAnglesArrayName": "EulerAngles",
245+
"FeatureIdsArrayPath": {
246+
"Attribute Matrix Name": "CellData",
247+
"Data Array Name": "FeatureIds",
248+
"Data Container Name": "SyntheticVolumeDataContainer"
249+
},
250+
"FeaturePhasesArrayPath": {
251+
"Attribute Matrix Name": "CellFeatureData",
252+
"Data Array Name": "Phases",
253+
"Data Container Name": "SyntheticVolumeDataContainer"
254+
},
255+
"FilterVersion": "1.0.152",
256+
"Filter_Human_Label": "Match Crystallography",
257+
"Filter_Name": "MatchCrystallography",
258+
"InputStatsArrayPath": {
259+
"Attribute Matrix Name": "CellEnsembleData",
260+
"Data Array Name": "Statistics",
261+
"Data Container Name": "StatsGeneratorDataContainer"
262+
},
263+
"MaxIterations": 100000,
264+
"NeighborListArrayPath": {
265+
"Attribute Matrix Name": "CellFeatureData",
266+
"Data Array Name": "NeighborList",
267+
"Data Container Name": "SyntheticVolumeDataContainer"
268+
},
269+
"NumFeaturesArrayPath": {
270+
"Attribute Matrix Name": "CellEnsembleData",
271+
"Data Array Name": "NumFeatures",
272+
"Data Container Name": "SyntheticVolumeDataContainer"
273+
},
274+
"PhaseTypesArrayPath": {
275+
"Attribute Matrix Name": "CellEnsembleData",
276+
"Data Array Name": "PhaseTypes",
277+
"Data Container Name": "StatsGeneratorDataContainer"
278+
},
279+
"SharedSurfaceAreaListArrayPath": {
280+
"Attribute Matrix Name": "CellFeatureData",
281+
"Data Array Name": "SharedSurfaceAreaList",
282+
"Data Container Name": "SyntheticVolumeDataContainer"
283+
},
284+
"SurfaceFeaturesArrayPath": {
285+
"Attribute Matrix Name": "CellFeatureData",
286+
"Data Array Name": "SurfaceFeatures",
287+
"Data Container Name": "SyntheticVolumeDataContainer"
288+
},
289+
"VolumesArrayName": "Volumes"
290+
},
291+
"6": {
292+
"FilterVersion": "1.0.152",
293+
"Filter_Human_Label": "Write SIMPLView Data File",
294+
"Filter_Name": "DataContainerWriter",
295+
"OutputFile": "Data/Synthetic1.dream3d",
296+
"WriteXdmfFile": 1
297+
},
298+
"PipelineBuilder": {
299+
"Name": "ExampleStatsGeneratorPipeline",
300+
"Number_Filters": 7,
301+
"Version": "1.0"
302+
}
303+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
set(PLUGIN_NAME "StatsGenerator")
2+
set(${PLUGIN_NAME}Examples_SOURCE_DIR ${${PLUGIN_NAME}_SOURCE_DIR}/Examples)
3+
set(${PLUGIN_NAME}Examples_BINARY_DIR ${${PLUGIN_NAME}_BINARY_DIR}/Examples)
4+
5+
6+
configure_file(${${PLUGIN_NAME}Examples_SOURCE_DIR}/StatsGeneratorExamples.h.in
7+
${${PLUGIN_NAME}Examples_BINARY_DIR}/StatsGeneratorExample.h
8+
)
9+
10+
include_directories(${${PLUGIN_NAME}Examples_BINARY_DIR})
11+
include_directories(${${PLUGIN_NAME}_BINARY_DIR}/Examples)
12+
13+
14+
set(${PLUGIN_NAME}Examples_SRCS
15+
${${PLUGIN_NAME}Examples_SOURCE_DIR}/ModifySGPipeline.cpp
16+
${${PLUGIN_NAME}Examples_BINARY_DIR}/StatsGeneratorExample.h
17+
)
18+
19+
add_executable(ModifySGPipeline ${${PLUGIN_NAME}Examples_SRCS})
20+
target_link_libraries(ModifySGPipeline Qt5::Core)

0 commit comments

Comments
 (0)