Skip to content
Permalink
Browse files

Feature/912 import ebsd montage (#913)

* 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 e4e1d224e3f55a627ac3ce474c500da899d63f7d
@@ -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)
{

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

#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
* EbsdMontageImportFilterParameter. There are 4 required parameters that are always passed to this macro
@@ -124,8 +69,8 @@ class EbsdMontageImportFilterParameter : public FilterParameter
SIMPL_STATIC_NEW_MACRO(EbsdMontageImportFilterParameter)
SIMPL_TYPE_MACRO_SUPER_OVERRIDE(EbsdMontageImportFilterParameter, FilterParameter)

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

/**
* @brief New This function instantiates an instance of the EbsdMontageImportFilterParameter. Although this
@@ -143,7 +88,7 @@ class EbsdMontageImportFilterParameter : public FilterParameter
* that this FilterParameter subclass represents.
* @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);

~EbsdMontageImportFilterParameter() override;
@@ -275,7 +275,7 @@ void EbsdMontageImportWidget::getGuiParametersFromFilter()
{
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);
setValidFilePath(data.InputPath);
@@ -434,7 +434,7 @@ void EbsdMontageImportWidget::filterNeedsInputParameters(AbstractFilter* filter)
SIMPLDataPathValidator* validator = SIMPLDataPathValidator::Instance();
QString inputPath = validator->convertToAbsolutePath(m_Ui->inputDir->text());

EbsdMontageListInfo_t data;
EbsdMontageListInfo data;
data.IncrementIndex = m_Ui->increment->value();
data.RowStart = m_Ui->rowStart->value();
data.RowEnd = m_Ui->rowEnd->value() + 1;
@@ -56,7 +56,7 @@ class OrientationAnalysis_EXPORT ImportEbsdMontage : public AbstractFilter
PYB11_PROPERTY(DataArrayPath DataContainerName READ getDataContainerName WRITE setDataContainerName)
PYB11_PROPERTY(QString CellEnsembleAttributeMatrixName READ getCellEnsembleAttributeMatrixName WRITE setCellEnsembleAttributeMatrixName)
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(QString CellIPFColorsArrayName READ getCellIPFColorsArrayName WRITE setCellIPFColorsArrayName)

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

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

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

0 comments on commit e4e1d22

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