Skip to content
Permalink
Browse files

Updates to example python codes to allow them to properly execute (#911)

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
  • Loading branch information...
imikejackson committed Aug 16, 2019
1 parent 5ed3998 commit f6d811aad8d61970044d03b9517324d9bcd344b2
@@ -116,15 +116,16 @@ endif()
set(PREBUILT_SUPPORT_DIR "${DREAM3D_SUPPORT_DIR}")
set(test_index "0")
foreach(test ${PREBUILT_PIPELINE_NAMES} )
math(EXPR test_index "${test_index} + 1")
set(Example_PIPELINE_FILE "${DREAM3D_SUPPORT_DIR}/${test}.json")
FILE(APPEND ${TEST_PIPELINE_LIST_FILE} "${Example_PIPELINE_FILE}\n")

FILE(APPEND ${TEST_PIPELINE_LIST_FILE} "[${test_index}] ${Example_PIPELINE_FILE}\n")
#----------------
set(SIMPL_CTEST_TEST_DRIVER "${DREAM3DTest_BINARY_DIR}/PrebuiltPipelineTests/${test}.${TEST_SCRIPT_FILE_EXT}")
configure_file(${DREAM3DTest_SOURCE_DIR}/ctest_pipeline_driver.${TEST_SCRIPT_FILE_EXT} "${SIMPL_CTEST_TEST_DRIVER}" @ONLY)

string(REPLACE "/" "_" test "${test}")
math(EXPR test_index "${test_index} + 1")

add_test(NAME D3D_Prebuilt_${test_index} COMMAND "${SIMPL_CTEST_TEST_DRIVER}" )
endforeach()

@@ -87,9 +87,15 @@ def color_data_change_test():
row[1] = 128
row[2] = 0

newdata = sc.ConvertToDataArray("IPFColor", np_array, comp_dims[0])
#sc.RemoveArray(dca, ["EBSD Scan", "Scan Data", "IPFColor"])
didInsert = am.addOrReplaceAttributeArray(newdata[1])
if not np_array.flags.contiguous:
np_array = np.ascontiguousarray(np_array)
assert np_array.flags.contiguous, 'Only contiguous arrays are supported.'


# Create the wrapped DataArray<float> object
newdata = simpl.UInt8ArrayType(np_array, "IPFColor", False)
# Add the DataArray to the AttributeMatrix
am.addOrReplaceAttributeArray(newdata)

# ITK Image Writer
image_writer = itkimageprocessing.ITKImageWriter.New()
@@ -16,15 +16,9 @@ def small_in100_alignment():
# Create Data Container Array
dca = simpl.DataContainerArray.New()

# Read H5EBSD File
err = orientation_analysis.read_h5_ebsd(dca, "Small IN100", "Phase Data", "EBSD Scan Data",
sd.GetBuildDirectory() +
"/Data/Output/Reconstruction/SmallIN100.h5ebsd",
1, 117, True, sc.AngleRepresentation.Radians,
simpl.StringSet({"Fit", "Image Quality", "EulerAngles",
"SEM Signal", "Confidence Index", "Phases"}))
err = sc.ReadDREAM3DFile(dca, sd.GetBuildDirectory() + "/Data/Output/Reconstruction/SmallIN100.dream3d")
if err < 0:
print("ReadH5Ebsd ErrorCondition %d" % err)
print("Read DataContainerArray Structure Failed %d" % err)

# Threshold Objects
# Create the selected thresholds / comparison inputs for MultiThresholdObjects filter
@@ -16,38 +16,9 @@ def small_in100_presegmentation_processing():
dca = simpl.DataContainerArray.New()

# Read DREAM3D File
dcap = simpl.DataContainerArrayProxy()
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy("Confidence Index").Flag = 2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"EulerAngles").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Fit").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"IPFColor").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Image Quality").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Mask").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Phases").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Quats").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"SEM Signal").Flag =2

dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Phase Data").getDataArrayProxy(
"CrystalStructures").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Phase Data").getDataArrayProxy(
"LatticeConstants").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Phase Data").getDataArrayProxy(
"MaterialName").Flag =2

err = d3d.data_container_reader(dca,
sd.GetBuildDirectory() +
"/Data/Output/Reconstruction/03_SmallIN100_Aligned.dream3d",
False, dcap)
err = sc.ReadDREAM3DFile(dca, sd.GetBuildDirectory() + "/Data/Output/Reconstruction/03_SmallIN100_Aligned.dream3d")
if err < 0:
print("DataContainerReader ErrorCondition %d" % err)
print("Read DataContainerArray Structure Failed %d" % err)

# Neighbor Orientation Comparison (Bad Data)
err = orientation_analysis.bad_data_neighbor_orientation_check(dca, 5, 4,
@@ -16,39 +16,9 @@ def small_in100_segmentation():
dca = simpl.DataContainerArray.New()

# Read DREAM3D File
dcap = simpl.DataContainerArrayProxy()
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Confidence Index").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"EulerAngles").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Fit").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"IPFColor").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Image Quality").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Mask").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Phases").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Quats").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"SEM Signal").Flag =2

dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Phase Data").getDataArrayProxy(
"CrystalStructures").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Phase Data").getDataArrayProxy(
"LatticeConstants").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Phase Data").getDataArrayProxy(
"MaterialName").Flag =2

err = d3d.data_container_reader(dca,
sd.GetBuildDirectory() +
"/Data/Output/Reconstruction/04_SmallIN100_Presegmentation.dream3d",
False, dcap)
err = sc.ReadDREAM3DFile(dca, sd.GetBuildDirectory() + "/Data/Output/Reconstruction/04_SmallIN100_Presegmentation.dream3d")
if err < 0:
print("DataContainerReader ErrorCondition %d" % err)
print("Read DataContainerArray Structure Failed %d" % err)

# Segment Features (Misorientation)
err = reconstruction.ebsd_segment_features(dca, "Grain Data", 5, True,
@@ -20,43 +20,9 @@ def small_in100_postseg_processing():
dca = simpl.DataContainerArray.New()

# Read DREAM3D File
dcap = simpl.DataContainerArrayProxy()
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Confidence Index").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"EulerAngles").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Fit").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"IPFColor").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Image Quality").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Mask").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Phases").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Quats").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"SEM Signal").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"FeatureIds").Flag =2

dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Phase Data").getDataArrayProxy(
"CrystalStructures").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Phase Data").getDataArrayProxy(
"LatticeConstants").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Phase Data").getDataArrayProxy(
"MaterialName").Flag =2

dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Grain Data").getDataArrayProxy("Active").Flag =2

err = d3d.data_container_reader(dca,
sd.GetBuildDirectory() +
"/Data/Output/Reconstruction/05_SmallIN100_Segmentation.dream3d",
False, dcap)
err = sc.ReadDREAM3DFile(dca, sd.GetBuildDirectory() + "/Data/Output/Reconstruction/05_SmallIN100_Segmentation.dream3d")
if err < 0:
print("DataContainerReader ErrorCondition %d" % err)
print("Read DataContainerArray Structure Failed %d" % err)

# Find Feature Phases
err = generic.find_feature_phases(dca, simpl.DataArrayPath("Small IN100", "EBSD Scan Data", "FeatureIds"),
@@ -16,65 +16,9 @@ def small_in100_final_processing():
dca = simpl.DataContainerArray.New()

# Read DREAM3D File
dcap = simpl.DataContainerArrayProxy()
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Confidence Index").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"EulerAngles").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Fit").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"IPFColor").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Image Quality").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Mask").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Phases").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"Quats").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"SEM Signal").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"FeatureIds").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("EBSD Scan Data").getDataArrayProxy(
"ParentIds").Flag =2

dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Phase Data").getDataArrayProxy(
"CrystalStructures").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Phase Data").getDataArrayProxy(
"LatticeConstants").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Phase Data").getDataArrayProxy(
"MaterialName").Flag =2

dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Grain Data").getDataArrayProxy("Active").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Grain Data").getDataArrayProxy(
"AvgEuler").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Grain Data").getDataArrayProxy(
"AvgQuats").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Grain Data").getDataArrayProxy(
"EquivalentDiameters").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Grain Data").getDataArrayProxy(
"NumElements").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Grain Data").getDataArrayProxy(
"NumNeighbors").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Grain Data").getDataArrayProxy(
"NumNeighbors2").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Grain Data").getDataArrayProxy(
"ParentIds").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Grain Data").getDataArrayProxy("Phases").Flag =2
dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("Grain Data").getDataArrayProxy(
"Volumes").Flag =2

dcap.getDataContainerProxy("Small IN100").getAttributeMatrixProxy("NewGrain Data").getDataArrayProxy(
"Active").Flag =2

err = d3d.data_container_reader(dca,
sd.GetBuildDirectory() +
"/Data/Output/Reconstruction/06_SmallIN100_Postsegmentation.dream3d",
False, dcap)
err = sc.ReadDREAM3DFile(dca, sd.GetBuildDirectory() + "/Data/Output/Reconstruction/06_SmallIN100_Postsegmentation.dream3d")
if err < 0:
print("DataContainerReader ErrorCondition %d" % err)
print("Read DataContainerArray Structure Failed %d" % err)

# Fill Bad Data
err = processing.fill_bad_data(dca, False, 1000,

0 comments on commit f6d811a

Please sign in to comment.
You can’t perform that action at this time.