Permalink
Browse files

Create Filter and infrastructure to import Bruker Nano Esprit HDF5 fi…

…les (#857)

* Create Filter and infrastructure to import Bruker Nano Esprit HDF5 files

This new feature allows the import of Bruker Nano Esprit HDF5 EBSD files into
DREAM.3D. Option on the filter allows for the reading of the EBS Pattern Data.

A basic unit test for the underlying Ebsdlib reader and a unit test for the
filter is included but relies on the additions to the DREAM3D_Data repository.

closes #856 

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
  • Loading branch information...
imikejackson committed Jan 7, 2019
1 parent 7b5c5e9 commit fe9494deb44d7ab3dbe97d0cd312ac06aa82e84f
Showing with 4,979 additions and 1,707 deletions.
  1. +146 −0 Source/EbsdLib/BrukerNano/EspritConstants.h
  2. +153 −0 Source/EbsdLib/BrukerNano/EspritPhase.cpp
  3. +93 −0 Source/EbsdLib/BrukerNano/EspritPhase.h
  4. +71 −0 Source/EbsdLib/BrukerNano/H5EspritFields.cpp
  5. +90 −0 Source/EbsdLib/BrukerNano/H5EspritFields.h
  6. +960 −0 Source/EbsdLib/BrukerNano/H5EspritReader.cpp
  7. +221 −0 Source/EbsdLib/BrukerNano/H5EspritReader.h
  8. +30 −0 Source/EbsdLib/BrukerNano/SourceList.cmake
  9. +3 −0 Source/EbsdLib/CMakeLists.txt
  10. +51 −53 Source/EbsdLib/EbsdConstants.h
  11. +119 −92 Source/EbsdLib/EbsdMacros.h
  12. +56 −11 Source/EbsdLib/EbsdReader.h
  13. +89 −47 Source/EbsdLib/EbsdSetGetMacros.h
  14. +19 −19 Source/EbsdLib/H5EbsdVolumeInfo.cpp
  15. +13 −0 Source/EbsdLib/HKL/CtfConstants.h
  16. +2 −2 Source/EbsdLib/HKL/CtfFields.h
  17. +1 −1 Source/EbsdLib/HKL/CtfPhase.cpp
  18. +1 −1 Source/EbsdLib/HKL/CtfPhase.h
  19. +1 −21 Source/EbsdLib/HKL/CtfReader.cpp
  20. +39 −39 Source/EbsdLib/HKL/CtfReader.h
  21. +10 −10 Source/EbsdLib/HKL/H5CtfImporter.cpp
  22. +17 −44 Source/EbsdLib/HKL/H5CtfReader.cpp
  23. +30 −2 Source/EbsdLib/TSL/AngConstants.h
  24. +2 −3 Source/EbsdLib/TSL/AngFields.h
  25. +1 −1 Source/EbsdLib/TSL/AngPhase.cpp
  26. +11 −16 Source/EbsdLib/TSL/AngPhase.h
  27. +78 −55 Source/EbsdLib/TSL/AngReader.cpp
  28. +23 −18 Source/EbsdLib/TSL/AngReader.h
  29. +10 −10 Source/EbsdLib/TSL/H5AngImporter.cpp
  30. +77 −42 Source/EbsdLib/TSL/H5AngReader.cpp
  31. +39 −120 Source/EbsdLib/TSL/H5OIMReader.cpp
  32. +1 −1 Source/EbsdLib/TSL/H5OIMReader.h
  33. +0 −34 Source/EbsdLib/TSL/SourceList.cmake
  34. +2 −0 Source/EbsdLib/Test/AngImportTest.cpp
  35. +4 −3 Source/EbsdLib/Test/CMakeLists.txt
  36. +5 −0 Source/EbsdLib/Test/CtfReaderTest.cpp
  37. +2 −1 Source/EbsdLib/Test/EdaxOIMReaderTest.cpp
  38. +218 −0 Source/EbsdLib/Test/H5EspritReaderTest.cpp
  39. +6 −0 Source/EbsdLib/Test/TestFileLocations.h.in
  40. +110 −0 Source/Plugins/OrientationAnalysis/Documentation/OrientationAnalysisFilters/ImportH5EspritData.md
  41. +4 −4 ...ntationAnalysis/Documentation/OrientationAnalysisFilters/{ReadEdaxH5Data.md → ImportH5OimData.md}
  42. +108 −0 Source/Plugins/OrientationAnalysis/FilterParameters/OEMEbsdScanSelectionFilterParameter.cpp
  43. +82 −0 Source/Plugins/OrientationAnalysis/FilterParameters/OEMEbsdScanSelectionFilterParameter.h
  44. +0 −108 Source/Plugins/OrientationAnalysis/FilterParameters/ReadEdaxH5DataFilterParameter.cpp
  45. +0 −85 Source/Plugins/OrientationAnalysis/FilterParameters/ReadEdaxH5DataFilterParameter.h
  46. +2 −2 Source/Plugins/OrientationAnalysis/FilterParameters/SourceList.cmake
  47. +49 −47 ...onAnalysis/Gui/FilterParameterWidgets/{ReadEdaxH5DataWidget.cpp → OEMEbsdScanSelectionWidget.cpp}
  48. +100 −0 Source/Plugins/OrientationAnalysis/Gui/FilterParameterWidgets/OEMEbsdScanSelectionWidget.h
  49. +0 −103 Source/Plugins/OrientationAnalysis/Gui/FilterParameterWidgets/ReadEdaxH5DataWidget.h
  50. +1 −1 Source/Plugins/OrientationAnalysis/Gui/FilterParameterWidgets/SourceList.cmake
  51. +3 −3 ...sis/Gui/FilterParameterWidgets/UI_Files/{ReadEdaxH5DataWidget.ui → OEMEbsdScanSelectionWidget.ui}
  52. +16 −16 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/EbsdToH5Ebsd.cpp
  53. +703 −0 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/ImportH5EspritData.cpp
  54. +156 −0 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/ImportH5EspritData.h
  55. +336 −270 ...Plugins/OrientationAnalysis/OrientationAnalysisFilters/{ReadEdaxH5Data.cpp → ImportH5OimData.cpp}
  56. +294 −0 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/ImportH5OimData.h
  57. +117 −105 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/ReadAngData.cpp
  58. +2 −2 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/ReadAngData.h
  59. +3 −3 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/ReadCtfData.cpp
  60. +1 −1 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/ReadCtfData.h
  61. +0 −283 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/ReadEdaxH5Data.h
  62. +11 −11 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/ReadH5Ebsd.cpp
  63. +2 −2 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/ReadH5Ebsd.h
  64. +2 −2 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/SourceList.cmake
  65. +2 −6 Source/Plugins/OrientationAnalysis/Test/CMakeLists.txt
  66. +6 −3 Source/Plugins/OrientationAnalysis/Test/CreateLambertSphereTest.cpp
  67. +162 −0 Source/Plugins/OrientationAnalysis/Test/ImportH5EspritDataTest.cpp
  68. +9 −0 Source/Plugins/OrientationAnalysis/Test/TestFileLocations.h.in
  69. +4 −4 Source/Plugins/SyntheticBuilding/SyntheticBuildingFilters/StatsGeneratorUtilities.cpp
@@ -0,0 +1,146 @@
/* ============================================================================
* Copyright (c) 2019 BlueQuartz Software, LLC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the names of any of the BlueQuartz Software contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#pragma once

#include <QtCore/QString>

namespace Ebsd
{
namespace Esprit
{
const QString EulerAngles("EulerAngles");
const QString CrystalStructures("CrystalStructures");
const QString MaterialName("MaterialName");
const QString LatticeConstants("LatticeConstants");
const QString BravaisLattice("BravaisLattice");
// const QString PatternData("PatternData");
} // namespace Esprit
namespace H5Esprit
{
const QString BrukerNano("Bruker Nano");
const QString Manufacturer("Manufacturer");
const QString Version("Version");
const QString H5FileExt("h5");
const QString Isometric("isometric");
const QString EBSD("EBSD");
const QString Header("Header");
const QString Phases("Phases");
const QString Data("Data");

// Header Section for EBSD Data
const QString CameraTilt("CameraTilt");
const QString GridType("Grid Type");
const QString KV("KV");
const QString MADMax("MADMax");
const QString Magnification("Magnification");
const QString MapStepFactor("MapStepFactor");
const QString MaxRadonBandCount("MaxRadonBandCount");
const QString MinIndexedBands("MinIndexedBands");
const QString NCOLS("NCOLS");
const QString NPoints("NPoints");
const QString NROWS("NROWS");
const QString OriginalFile("OriginalFile");
const QString PatternHeight("PatternHeight");
const QString PatternWidth("PatternWidth");
const QString PixelByteCount("PixelByteCount");
const QString SEMImage("SEM Image"); // <=== Actual SEM Image is stored here.
const QString SEPixelSizeX("SEPixelSizeX");
const QString SEPixelSizeY("SEPixelSizeY");
const QString SampleTilt("SampleTilt");
const QString TopClip("TopClip");
const QString UnClippedPatternHeight("UnClippedPatternHeight");
const QString WD("WD");
const QString XSTEP("XSTEP");
const QString YSTEP("YSTEP");
const QString ZOffset("ZOffset");

// Phases section of EBSD/Header
const QString Formula("Formula");
const QString IT("IT");
const QString LatticeConstants("LatticeConstants");
const QString Name("Name");
const QString Setting("Setting");
const QString SpaceGroup("SpaceGroup");

// Data Section for EBSD Data
const QString DD("DD");
const QString MAD("MAD");
const QString MADPhase("MADPhase");
const QString NIndexedBands("NIndexedBands");
const QString PCX("PCX");
const QString PCY("PCY");
const QString PHI("PHI");
const QString Phase("Phase");
const QString RadonBandCount("RadonBandCount");
const QString RadonQuality("RadonQuality");
const QString RawPatterns("RawPatterns");
const QString XBEAM("X BEAM");
const QString YBEAM("Y BEAM");
const QString XSAMPLE("X SAMPLE");
const QString YSAMPLE("Y SAMPLE");
const QString phi1("phi1");
const QString phi2("phi2");

using DD_t = float;
using MAD_t = float;
using MADPhase_t = int32_t;
using NIndexedBands_t = int32_t;
using PCX_t = float;
using PCY_t = float;
using PHI_t = float;
using Phase_t = int32_t;
using RadonBandCount_t = int32_t;
using RadonQuality_t = float;
using RawPatterns_t = uint8_t;
using XBEAM_t = int32_t;
using YBEAM_t = int32_t;
using XSAMPLE_t = float;
using YSAMPLE_t = float;
using phi1_t = float;
using phi2_t = float;

const QString SEM("SEM");
// Header Section for SEM Data
const QString SEM_IX("SEM IX");
const QString SEM_IY("SEM IY");
const QString SEM_Image("SEM Image");
const QString SEM_ImageHeight("SEM ImageHeight");
const QString SEM_ImageWidth("SEM ImageWidth");
const QString SEM_KV("SEM KV");
const QString SEM_Magnification("SEM Magnification");
const QString SEM_WD("SEM WD");
const QString SEM_XResolution("SEM XResolution");
const QString SEM_YResolution("SEM YResolution");
const QString SEM_ZOffset("SEM ZOffset");

} // namespace H5Esprit
} // namespace Ebsd
@@ -0,0 +1,153 @@
/* ============================================================================
* Copyright (c) 2019 BlueQuartz Software, LLC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the names of any of the BlueQuartz Software contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

#include "EspritPhase.h"

#include <cstring>

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
EspritPhase::EspritPhase()
: m_PhaseIndex(-1)
{
}

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
EspritPhase::~EspritPhase() = default;

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QString EspritPhase::getMaterialName()
{
return m_Name;
}

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
unsigned int EspritPhase::determineLaueGroup()
{
int sg = getIT();

if(sg >= 1 && sg <= 2)
{
return Ebsd::CrystalStructure::Triclinic;
}

if(sg >= 3 && sg <= 15)
{
return Ebsd::CrystalStructure::Monoclinic;
}

if(sg >= 16 && sg <= 74)
{
return Ebsd::CrystalStructure::OrthoRhombic;
}

if(sg >= 75 && sg <= 89)
{
return Ebsd::CrystalStructure::Tetragonal_Low;
}
if(sg >= 90 && sg <= 142)
{
return Ebsd::CrystalStructure::Tetragonal_High;
}

if(sg >= 143 && sg <= 148)
{
return Ebsd::CrystalStructure::Trigonal_Low;
}
if(sg >= 149 && sg <= 167)
{
return Ebsd::CrystalStructure::Trigonal_High;
}

if(sg >= 168 && sg <= 176)
{
return Ebsd::CrystalStructure::Hexagonal_Low;
}
if(sg >= 177 && sg <= 194)
{
return Ebsd::CrystalStructure::Hexagonal_High;
}

if(sg >= 195 && sg <= 206)
{
return Ebsd::CrystalStructure::Cubic_Low;
}
if(sg >= 207 && sg <= 230)
{
return Ebsd::CrystalStructure::Cubic_High;
}

return Ebsd::CrystalStructure::UnknownCrystalStructure;
}

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void EspritPhase::parseFormula(QList<QByteArray>& tokens)
{
m_Formula.clear();
for(int i = 1; i < tokens.size(); ++i)
{
m_Formula.append(tokens.at(i)).append(" ");
}
}

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void EspritPhase::parseName(QList<QByteArray>& tokens)
{
m_Name.clear();
for(int i = 1; i < tokens.size(); ++i)
{
m_Name.append(tokens.at(i)).append(" ");
}
}

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void EspritPhase::parseSpaceGroup(QList<QByteArray>& tokens)
{
m_SpaceGroup.clear();
for(int i = 1; i < tokens.size(); ++i)
{
m_SpaceGroup.append(tokens.at(i)).append(" ");
}
}
@@ -0,0 +1,93 @@
/* ============================================================================
* Copyright (c) 2019 BlueQuartz Software, LLC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the names of any of the BlueQuartz Software contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

#pragma once

#include <QtCore/QString>
#include <QtCore/QTextStream>
#include <QtCore/QVector>

#include "EbsdLib/EbsdConstants.h"
#include "EbsdLib/EbsdLib.h"
#include "EbsdLib/EbsdSetGetMacros.h"

class EbsdLib_EXPORT EspritPhase
{
public:
EBSD_SHARED_POINTERS(EspritPhase)
EBSD_STATIC_NEW_MACRO(EspritPhase)
EBSD_TYPE_MACRO(EspritPhase)

virtual ~EspritPhase();

EBSD_INSTANCE_PROPERTY(int, PhaseIndex)

EBSD_INSTANCE_STRING_PROPERTY(Formula)
EBSD_INSTANCE_PROPERTY(int, IT)
EBSD_INSTANCE_PROPERTY(QVector<float>, LatticeConstants)
EBSD_INSTANCE_STRING_PROPERTY(Name)
EBSD_INSTANCE_PROPERTY(int, Setting)
EBSD_INSTANCE_STRING_PROPERTY(SpaceGroup)

QString getMaterialName();

void parseFormula(QList<QByteArray>& tokens);
void parseName(QList<QByteArray>& tokens);
void parseSpaceGroup(QList<QByteArray>& tokens);

void printSelf(QTextStream& stream);

/**
* @brief Returns the type of crystal structure for this phase.
*/
unsigned int determineLaueGroup();

protected:
EspritPhase();

public:
EspritPhase(const EspritPhase&) = delete; // Copy Constructor Not Implemented
EspritPhase(EspritPhase&&) = delete; // Move Constructor Not Implemented
EspritPhase& operator=(const EspritPhase&) = delete; // Copy Assignment Not Implemented
EspritPhase& operator=(EspritPhase&&) = delete; // Move Assignment Not Implemented
};

struct Esprit_Private_Data
{
QVector<size_t> dims;
QVector<float> resolution;
QVector<float> origin;
QVector<EspritPhase::Pointer> phases;
int32_t units;
};

Q_DECLARE_METATYPE(Esprit_Private_Data)
Oops, something went wrong.

0 comments on commit fe9494d

Please sign in to comment.