Skip to content

Commit

Permalink
Feature/912 import ebsd montage (#913)
Browse files Browse the repository at this point in the history
* ImportEbsdMontage can now be updated from within the GUI.
* EbsdMontageImportFilterParameter.h no longer has a type alias that had been interfering with QMetaType. All references of EbsdMontageListInfo_t were replaced with the target type EbsdMontageListInfo.

fixes #912

Signed-off-by: Matthew Marine <matthew.marine@bluequartz.net>
  • Loading branch information
mmarineBlueQuartz committed Aug 26, 2019
1 parent f6d811a commit e4e1d22
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 66 deletions.
Expand Up @@ -51,7 +51,7 @@ EbsdMontageImportFilterParameter::~EbsdMontageImportFilterParameter() = default;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
EbsdMontageImportFilterParameter::Pointer EbsdMontageImportFilterParameter::New(const QString& humanLabel, const QString& propertyName, const EbsdMontageListInfo_t& defaultValue, EbsdMontageImportFilterParameter::Pointer EbsdMontageImportFilterParameter::New(const QString& humanLabel, const QString& propertyName, const EbsdMontageListInfo& defaultValue,
FilterParameter::Category category, SetterCallbackType setterCallback, GetterCallbackType getterCallback) FilterParameter::Category category, SetterCallbackType setterCallback, GetterCallbackType getterCallback)
{ {


Expand Down Expand Up @@ -85,7 +85,7 @@ void EbsdMontageImportFilterParameter::readJson(const QJsonObject& json)
if(!jsonValue.isUndefined() && m_SetterCallback) if(!jsonValue.isUndefined() && m_SetterCallback)
{ {
QJsonObject jsonObj = jsonValue.toObject(); QJsonObject jsonObj = jsonValue.toObject();
EbsdMontageListInfo_t fileListInfo; EbsdMontageListInfo fileListInfo;
fileListInfo.readJson(jsonObj); fileListInfo.readJson(jsonObj);
m_SetterCallback(fileListInfo); m_SetterCallback(fileListInfo);
} }
Expand All @@ -98,7 +98,7 @@ void EbsdMontageImportFilterParameter::writeJson(QJsonObject& json)
{ {
if(m_GetterCallback) if(m_GetterCallback)
{ {
EbsdMontageListInfo_t fileListInfo = m_GetterCallback(); EbsdMontageListInfo fileListInfo = m_GetterCallback();
QJsonObject jsonObj; QJsonObject jsonObj;
fileListInfo.writeJson(jsonObj); fileListInfo.writeJson(jsonObj);
json[getPropertyName()] = jsonObj; json[getPropertyName()] = jsonObj;
Expand Down
Expand Up @@ -44,61 +44,6 @@


#include "OrientationAnalysis/FilterParameters/EbsdMontageListInfo.h" #include "OrientationAnalysis/FilterParameters/EbsdMontageListInfo.h"


using EbsdMontageListInfo_t = EbsdMontageListInfo;

#if 0
typedef 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<qint32>(PaddingDigits);
json["Ordering"] = static_cast<qint32>(Ordering);
json["RowStart"] = static_cast<qint32>(RowStart);
json["ColStart"] = static_cast<qint32>(ColStart);
json["RowEnd"] = static_cast<qint32>(RowEnd);
json["ColEnd"] = static_cast<qint32>(ColEnd);
json["IncrementIndex"] = static_cast<qint32>(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"].toInt());
Ordering = static_cast<quint32>(json["Ordering"].toInt());
RowStart = static_cast<qint32>(json["RowStart"].toInt());
ColStart = static_cast<qint32>(json["ColStart"].toInt());
RowEnd = static_cast<qint32>(json["RowEnd"].toInt());
ColEnd = static_cast<qint32>(json["ColEnd"].toInt());
IncrementIndex = static_cast<qint32>(json["IncrementIndex"].toInt());
InputPath = json["InputPath"].toString();
FilePrefix = json["FilePrefix"].toString();
FileSuffix = json["FileSuffix"].toString();
FileExtension = json["FileExtension"].toString();
return true;
}
return false;
}
}EbsdMontageListInfo_t;
#endif

/** /**
* @brief SIMPL_NEW_EbsdMontageListInfo_FP This macro is a short-form way of instantiating an instance of * @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 * EbsdMontageImportFilterParameter. There are 4 required parameters that are always passed to this macro
Expand All @@ -124,8 +69,8 @@ class EbsdMontageImportFilterParameter : public FilterParameter
SIMPL_STATIC_NEW_MACRO(EbsdMontageImportFilterParameter) SIMPL_STATIC_NEW_MACRO(EbsdMontageImportFilterParameter)
SIMPL_TYPE_MACRO_SUPER_OVERRIDE(EbsdMontageImportFilterParameter, FilterParameter) SIMPL_TYPE_MACRO_SUPER_OVERRIDE(EbsdMontageImportFilterParameter, FilterParameter)


using SetterCallbackType = std::function<void(EbsdMontageListInfo_t)>; using SetterCallbackType = std::function<void(EbsdMontageListInfo)>;
using GetterCallbackType = std::function<EbsdMontageListInfo_t(void)>; using GetterCallbackType = std::function<EbsdMontageListInfo(void)>;


/** /**
* @brief New This function instantiates an instance of the EbsdMontageImportFilterParameter. Although this * @brief New This function instantiates an instance of the EbsdMontageImportFilterParameter. Although this
Expand All @@ -143,7 +88,7 @@ class EbsdMontageImportFilterParameter : public FilterParameter
* that this FilterParameter subclass represents. * that this FilterParameter subclass represents.
* @return * @return
*/ */
static Pointer New(const QString& humanLabel, const QString& propertyName, const EbsdMontageListInfo_t& defaultValue, Category category, SetterCallbackType setterCallback, static Pointer New(const QString& humanLabel, const QString& propertyName, const EbsdMontageListInfo& defaultValue, Category category, SetterCallbackType setterCallback,
GetterCallbackType getterCallback); GetterCallbackType getterCallback);


~EbsdMontageImportFilterParameter() override; ~EbsdMontageImportFilterParameter() override;
Expand Down
Expand Up @@ -275,7 +275,7 @@ void EbsdMontageImportWidget::getGuiParametersFromFilter()
{ {
blockSignals(true); blockSignals(true);


EbsdMontageListInfo_t data = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<EbsdMontageListInfo_t>(); EbsdMontageListInfo data = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<EbsdMontageListInfo>();


m_Ui->inputDir->setText(data.InputPath); m_Ui->inputDir->setText(data.InputPath);
setValidFilePath(data.InputPath); setValidFilePath(data.InputPath);
Expand Down Expand Up @@ -434,7 +434,7 @@ void EbsdMontageImportWidget::filterNeedsInputParameters(AbstractFilter* filter)
SIMPLDataPathValidator* validator = SIMPLDataPathValidator::Instance(); SIMPLDataPathValidator* validator = SIMPLDataPathValidator::Instance();
QString inputPath = validator->convertToAbsolutePath(m_Ui->inputDir->text()); QString inputPath = validator->convertToAbsolutePath(m_Ui->inputDir->text());


EbsdMontageListInfo_t data; EbsdMontageListInfo data;
data.IncrementIndex = m_Ui->increment->value(); data.IncrementIndex = m_Ui->increment->value();
data.RowStart = m_Ui->rowStart->value(); data.RowStart = m_Ui->rowStart->value();
data.RowEnd = m_Ui->rowEnd->value() + 1; data.RowEnd = m_Ui->rowEnd->value() + 1;
Expand Down
Expand Up @@ -56,7 +56,7 @@ class OrientationAnalysis_EXPORT ImportEbsdMontage : public AbstractFilter
PYB11_PROPERTY(DataArrayPath DataContainerName READ getDataContainerName WRITE setDataContainerName) PYB11_PROPERTY(DataArrayPath DataContainerName READ getDataContainerName WRITE setDataContainerName)
PYB11_PROPERTY(QString CellEnsembleAttributeMatrixName READ getCellEnsembleAttributeMatrixName WRITE setCellEnsembleAttributeMatrixName) PYB11_PROPERTY(QString CellEnsembleAttributeMatrixName READ getCellEnsembleAttributeMatrixName WRITE setCellEnsembleAttributeMatrixName)
PYB11_PROPERTY(QString CellAttributeMatrixName READ getCellAttributeMatrixName WRITE setCellAttributeMatrixName) PYB11_PROPERTY(QString CellAttributeMatrixName READ getCellAttributeMatrixName WRITE setCellAttributeMatrixName)
PYB11_PROPERTY(EbsdMontageListInfo_t InputFileListInfo READ getInputFileListInfo WRITE setInputFileListInfo) PYB11_PROPERTY(EbsdMontageListInfo InputFileListInfo READ getInputFileListInfo WRITE setInputFileListInfo)
PYB11_PROPERTY(bool GenerateIPFColorMap READ getGenerateIPFColorMap WRITE setGenerateIPFColorMap) PYB11_PROPERTY(bool GenerateIPFColorMap READ getGenerateIPFColorMap WRITE setGenerateIPFColorMap)
PYB11_PROPERTY(QString CellIPFColorsArrayName READ getCellIPFColorsArrayName WRITE setCellIPFColorsArrayName) PYB11_PROPERTY(QString CellIPFColorsArrayName READ getCellIPFColorsArrayName WRITE setCellIPFColorsArrayName)


Expand All @@ -76,8 +76,8 @@ class OrientationAnalysis_EXPORT ImportEbsdMontage : public AbstractFilter
SIMPL_FILTER_PARAMETER(QString, CellAttributeMatrixName) SIMPL_FILTER_PARAMETER(QString, CellAttributeMatrixName)
Q_PROPERTY(QString CellAttributeMatrixName READ getCellAttributeMatrixName WRITE setCellAttributeMatrixName) Q_PROPERTY(QString CellAttributeMatrixName READ getCellAttributeMatrixName WRITE setCellAttributeMatrixName)


SIMPL_FILTER_PARAMETER(EbsdMontageListInfo_t, InputFileListInfo) SIMPL_FILTER_PARAMETER(EbsdMontageListInfo, InputFileListInfo)
Q_PROPERTY(EbsdMontageListInfo_t InputFileListInfo READ getInputFileListInfo WRITE setInputFileListInfo) Q_PROPERTY(EbsdMontageListInfo InputFileListInfo READ getInputFileListInfo WRITE setInputFileListInfo)


SIMPL_FILTER_PARAMETER(bool, GenerateIPFColorMap) SIMPL_FILTER_PARAMETER(bool, GenerateIPFColorMap)
Q_PROPERTY(bool GenerateIPFColorMap READ getGenerateIPFColorMap WRITE setGenerateIPFColorMap) Q_PROPERTY(bool GenerateIPFColorMap READ getGenerateIPFColorMap WRITE setGenerateIPFColorMap)
Expand Down

0 comments on commit e4e1d22

Please sign in to comment.