Permalink
Browse files

Create a filter that will import a montage of EBSD Data (#854)

This filter allows the user to import a montage or mosaic of EBSD data files
either (.ang or .ctf) and will place each EBSD file into its own DataContainer
for later processing by the EBSD montaging filters.

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
  • Loading branch information...
imikejackson committed Jan 7, 2019
1 parent 9a47373 commit 7b5c5e95bbb4aad037749a2bed17c9c0d0a96fad
@@ -0,0 +1,53 @@
# Import Ebsd Montage #

## Group (Subgroup) ##

Import/Export (Montage Import)

## Description ##

This **Filter** will import a collection of EBSD data files (Edax .ang or Oxford .ctf) and roughly calculate the proper coordiates for each tile within the global reference frame. Each data file will be placed into it's own DataContainer. This filter uses the _ReadAngData_ or _ReadCtfData_ filters to import the data. The filenames need to be named with the following pattern.

[File Prefix]r[RowIndex]c[ColIndex][FileSuffix].ang

The user can set the name of the Cell and Ensemble Attribute Matrix that will be created in each DataContainer. The name of each DataContainer is based off the file used to populate the input data for that DataContainer.

## Parameters ##

| Name | Type | Description |
|------|------|------|
| Parameter Name | Parameter Type | Description of parameter... |

## Required Geometry ##

Required Geometry Type -or- Not Applicable

## Required Objects ##

| Kind | Default Name | Type | Component Dimensions | Description |
|------|--------------|-------------|---------|-----|
| **Data Container** | Data Container Name | N/A | N/A | Description of object... |
| **Attribute Matrix** | Attribute Matrix Name | Element/Feature/Ensemble/etc. | N/A | Description of object... |
| **Element/Feature/Ensemble/etc. Attribute Array** | AttributeArray Name | int32_t/float/etc. | (1)/(3)/etc. | Description of object... |

## Created Objects ##

| Kind | Default Name | Type | Component Dimensions | Description |
|------|--------------|-------------|---------|-----|
| **Data Container** | Data Container Name | N/A | N/A | Description of object... |
| **Attribute Matrix** | Attribute Matrix Name | Element/Feature/Ensemble/etc. | N/A | Description of object... |
| **Element/Feature/Ensemble/etc. Attribute Array** | AttributeArray Name | int32_t/float/etc. | (1)/(3)/etc. | Description of object... |


## Example Pipelines ##

List the names of the example pipelines where this filter is used.

## License & Copyright ##

Please see the description file distributed with this plugin.

## DREAM3D Mailing Lists ##

If you need more help with a filter, please consider asking your question on the DREAM3D Users mailing list:
https://groups.google.com/forum/?hl=en#!forum/dream3d-users
@@ -0,0 +1,106 @@
/* ============================================================================
* Copyright (c) 2009-2016 BlueQuartz Software, LLC
*
* 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 name of BlueQuartz Software, the US Air Force, nor the names of its
* 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.
*
* The code contained herein was partially funded by the followig contracts:
* United States Air Force Prime Contract FA8650-07-D-5800
* United States Air Force Prime Contract FA8650-10-D-5210
* United States Prime Contract Navy N00173-07-C-2068
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

#include "EbsdMontageImportFilterParameter.h"

#include <QtCore/QJsonObject>
#include <QtCore/QJsonValue>

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
EbsdMontageImportFilterParameter::EbsdMontageImportFilterParameter() = default;

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

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
EbsdMontageImportFilterParameter::Pointer EbsdMontageImportFilterParameter::New(const QString& humanLabel, const QString& propertyName, const EbsdMontageListInfo_t& defaultValue,
FilterParameter::Category category, SetterCallbackType setterCallback, GetterCallbackType getterCallback)
{

EbsdMontageImportFilterParameter::Pointer ptr = EbsdMontageImportFilterParameter::New();
ptr->setHumanLabel(humanLabel);
ptr->setPropertyName(propertyName);
QVariant v;
v.setValue(defaultValue);
ptr->setDefaultValue(v);
ptr->setCategory(category);
ptr->setSetterCallback(setterCallback);
ptr->setGetterCallback(getterCallback);

return ptr;
}

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QString EbsdMontageImportFilterParameter::getWidgetType() const
{
return QString("EbsdMontageImportWidget");
}

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void EbsdMontageImportFilterParameter::readJson(const QJsonObject& json)
{
QJsonValue jsonValue = json[getPropertyName()];
if(!jsonValue.isUndefined() && m_SetterCallback)
{
QJsonObject jsonObj = jsonValue.toObject();
EbsdMontageListInfo_t fileListInfo;
fileListInfo.readJson(jsonObj);
m_SetterCallback(fileListInfo);
}
}

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void EbsdMontageImportFilterParameter::writeJson(QJsonObject& json)
{
if(m_GetterCallback)
{
EbsdMontageListInfo_t fileListInfo = m_GetterCallback();
QJsonObject jsonObj;
fileListInfo.writeJson(jsonObj);
json[getPropertyName()] = jsonObj;
}
}
@@ -0,0 +1,193 @@
/* ============================================================================
* Copyright (c) 2009-2016 BlueQuartz Software, LLC
*
* 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 name of BlueQuartz Software, the US Air Force, nor the names of its
* 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.
*
* The code contained herein was partially funded by the followig contracts:
* United States Air Force Prime Contract FA8650-07-D-5800
* United States Air Force Prime Contract FA8650-10-D-5210
* United States Prime Contract Navy N00173-07-C-2068
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

#pragma once

#include <QtCore/QJsonObject>
#include <QtCore/QMetaType>
#include <QtCore/QString>

#include "SIMPLib/Common/SIMPLibSetGetMacros.h"
#include "SIMPLib/FilterParameters/FilterParameter.h"
#include "SIMPLib/SIMPLib.h"

using EbsdMontageListInfo_t = struct
{
qint32 PaddingDigits = 3;
quint32 Ordering = 0; /* Ordering=0 = RowColumn, Ordering=1 = ColumnRow */
qint32 RowStart = 0;
qint32 RowEnd = 2;
qint32 ColStart = 0;
qint32 ColEnd = 2;
qint32 IncrementIndex = 1;
QString InputPath;
QString FilePrefix;
QString FileSuffix;
QString FileExtension;

void writeJson(QJsonObject& json)
{
json["PaddingDigits"] = static_cast<double>(PaddingDigits);
json["Ordering"] = static_cast<double>(Ordering);
json["RowStart"] = static_cast<double>(RowStart);
json["ColStart"] = static_cast<double>(ColStart);
json["RowEnd"] = static_cast<double>(RowEnd);
json["ColEnd"] = static_cast<double>(ColEnd);
json["IncrementIndex"] = static_cast<double>(IncrementIndex);
json["InputPath"] = InputPath;
json["FilePrefix"] = FilePrefix;
json["FileSuffix"] = FileSuffix;
json["FileExtension"] = FileExtension;
}

bool readJson(QJsonObject& json)
{
if(json["PaddingDigits"].isDouble() && json["Ordering"].isDouble() && json["RowStart"].isDouble() && json["ColStart"].isDouble() && json["IncrementIndex"].isDouble() &&
json["InputPath"].isString() && json["FilePrefix"].isString() && json["FileSuffix"].isString() && json["FileExtension"].isString())
{
PaddingDigits = static_cast<qint32>(json["PaddingDigits"].toDouble());
Ordering = static_cast<quint32>(json["Ordering"].toDouble());
RowStart = static_cast<qint32>(json["RowStart"].toDouble());
ColStart = static_cast<qint32>(json["ColStart"].toDouble());
RowEnd = static_cast<qint32>(json["RowEnd"].toDouble());
ColEnd = static_cast<qint32>(json["ColEnd"].toDouble());
IncrementIndex = static_cast<qint32>(json["IncrementIndex"].toDouble());
InputPath = json["InputPath"].toString();
FilePrefix = json["FilePrefix"].toString();
FileSuffix = json["FileSuffix"].toString();
FileExtension = json["FileExtension"].toString();
return true;
}
return false;
}
};

Q_DECLARE_METATYPE(EbsdMontageListInfo_t)

/**
* @brief SIMPL_NEW_EbsdMontageListInfo_FP This macro is a short-form way of instantiating an instance of
* EbsdMontageImportFilterParameter. There are 4 required parameters that are always passed to this macro
* in the following order: HumanLabel, PropertyName, Category, FilterName (class name).
*
* Therefore, the macro should be written like this (this is a concrete example):
* SIMPL_NEW_EbsdMontageListInfo_FP("HumanLabel", PropertyName, Category, FilterName)
*
* Example 1 (instantiated within a filter called [GenericExample](@ref genericexample)):
* SIMPL_NEW_EbsdMontageListInfo_FP("Input File List", InputEbsdMontageListInfo, FilterParameter::Parameter, GenericExample);
*/
#define SIMPL_NEW_EbsdMontageListInfo_FP(...) \
SIMPL_EXPAND(_FP_GET_OVERRIDE(__VA_ARGS__, SIMPL_NEW_FP_9, SIMPL_NEW_FP_8, SIMPL_NEW_FP_7, SIMPL_NEW_FP_6, SIMPL_NEW_FP_5, SIMPL_NEW_FP_4)(EbsdMontageImportFilterParameter, __VA_ARGS__))

/**
* @brief The EbsdMontageImportFilterParameter class is used by filters to instantiate an EbsdMontageListInfoWidget. By instantiating an instance of
* this class in a filter's setupFilterParameters() method, a EbsdMontageListInfoWidget will appear in the filter's "filter input" section in the DREAM3D GUI.
*/
class EbsdMontageImportFilterParameter : public FilterParameter
{
public:
SIMPL_SHARED_POINTERS(EbsdMontageImportFilterParameter)
SIMPL_STATIC_NEW_MACRO(EbsdMontageImportFilterParameter)
SIMPL_TYPE_MACRO_SUPER_OVERRIDE(EbsdMontageImportFilterParameter, FilterParameter)

typedef std::function<void(EbsdMontageListInfo_t)> SetterCallbackType;
typedef std::function<EbsdMontageListInfo_t(void)> GetterCallbackType;

/**
* @brief New This function instantiates an instance of the EbsdMontageImportFilterParameter. Although this
* function is available to be used, the preferable way to instantiate an instance of this class is to use the
* SIMPL_NEW_EbsdMontageListInfo_FP(...) macro at the top of this file.
* @param humanLabel The name that the users of DREAM.3D see for this filter parameter
* @param propertyName The internal property name for this filter parameter.
* @param defaultValue The value that this filter parameter will be initialized to by default.
* @param category The category for the filter parameter in the DREAM.3D user interface. There
* are three categories: Parameter, Required Arrays, and Created Arrays.
* @param setterCallback The method in the AbstractFilter subclass that <i>sets</i> the value of the property
* that this FilterParameter subclass represents.
* @param getterCallback The method in the AbstractFilter subclass that <i>gets</i> the value of the property
* that this FilterParameter subclass represents.
* @return
*/
static Pointer New(const QString& humanLabel, const QString& propertyName, const EbsdMontageListInfo_t& defaultValue, Category category, SetterCallbackType setterCallback,
GetterCallbackType getterCallback);

~EbsdMontageImportFilterParameter() override;

/**
* @brief getWidgetType Returns the type of widget that displays and controls
* this FilterParameter subclass
* @return
*/
QString getWidgetType() const override;

/**
* @brief readJson Reads this filter parameter's corresponding property out of a QJsonObject.
* @param json The QJsonObject that the filter parameter reads from.
*/
void readJson(const QJsonObject& json) override;

/**
* @brief writeJson Writes this filter parameter's corresponding property to a QJsonObject.
* @param json The QJsonObject that the filter parameter writes to.
*/
void writeJson(QJsonObject& json) override;

/**
* @param SetterCallback The method in the AbstractFilter subclass that <i>sets</i> the value of the property
* that this FilterParameter subclass represents.
* from the filter parameter.
*/
SIMPL_INSTANCE_PROPERTY(SetterCallbackType, SetterCallback)

/**
* @param GetterCallback The method in the AbstractFilter subclass that <i>gets</i> the value of the property
* that this FilterParameter subclass represents.
* @return The GetterCallback
*/
SIMPL_INSTANCE_PROPERTY(GetterCallbackType, GetterCallback)

protected:
/**
* @brief EbsdMontageImportFilterParameter The default constructor. It is protected because this
* filter parameter should only be instantiated using its New(...) function or short-form macro.
*/
EbsdMontageImportFilterParameter();

public:
EbsdMontageImportFilterParameter(const EbsdMontageImportFilterParameter&) = delete; // Copy Constructor Not Implemented
EbsdMontageImportFilterParameter(EbsdMontageImportFilterParameter&&) = delete; // Move Constructor Not Implemented
EbsdMontageImportFilterParameter& operator=(const EbsdMontageImportFilterParameter&) = delete; // Copy Assignment Not Implemented
EbsdMontageImportFilterParameter& operator=(EbsdMontageImportFilterParameter&&) = delete; // Move Assignment Not Implemented
};
@@ -11,6 +11,7 @@ set (${PLUGIN_NAME}_FilterParameters_SRCS
${${PLUGIN_NAME}_SOURCE_DIR}/FilterParameters/ReadEdaxH5DataFilterParameter.cpp
${${PLUGIN_NAME}_SOURCE_DIR}/FilterParameters/ReadH5EbsdFilterParameter.cpp
${${PLUGIN_NAME}_SOURCE_DIR}/FilterParameters/OrientationUtilityFilterParameter.cpp
${${PLUGIN_NAME}_SOURCE_DIR}/FilterParameters/EbsdMontageImportFilterParameter.cpp
)

set (${PLUGIN_NAME}_FilterParameters_HDRS
@@ -20,5 +21,6 @@ set (${PLUGIN_NAME}_FilterParameters_HDRS
${${PLUGIN_NAME}_SOURCE_DIR}/FilterParameters/ReadEdaxH5DataFilterParameter.h
${${PLUGIN_NAME}_SOURCE_DIR}/FilterParameters/ReadH5EbsdFilterParameter.h
${${PLUGIN_NAME}_SOURCE_DIR}/FilterParameters/OrientationUtilityFilterParameter.h
${${PLUGIN_NAME}_SOURCE_DIR}/FilterParameters/EbsdMontageImportFilterParameter.h
)
cmp_IDE_SOURCE_PROPERTIES( "FilterParameters" "${${PLUGIN_NAME}_FilterParameters_HDRS}" "${${PLUGIN_NAME}_FilterParameters_SRCS}" "${PROJECT_INSTALL_HEADERS}")
Oops, something went wrong.

0 comments on commit 7b5c5e9

Please sign in to comment.