diff --git a/Source/Plugins/Sampling/SamplingFilters/CropImageGeometry.cpp b/Source/Plugins/Sampling/SamplingFilters/CropImageGeometry.cpp index 51ad84cd6f..6d404b1d42 100644 --- a/Source/Plugins/Sampling/SamplingFilters/CropImageGeometry.cpp +++ b/Source/Plugins/Sampling/SamplingFilters/CropImageGeometry.cpp @@ -96,30 +96,33 @@ void CropImageGeometry::setupFilterParameters() parameters.push_back(SIMPL_NEW_INTEGER_FP("Y Max (Row) [Inclusive]", YMax, FilterParameter::Parameter, CropImageGeometry)); parameters.push_back(SIMPL_NEW_INTEGER_FP("Z Max (Plane) [Inclusive]", ZMax, FilterParameter::Parameter, CropImageGeometry)); QStringList linkedProps; - linkedProps << "CellFeatureAttributeMatrixPath" - << "FeatureIdsArrayPath"; - parameters.push_back(SIMPL_NEW_LINKED_BOOL_FP("Renumber Features", RenumberFeatures, FilterParameter::Parameter, CropImageGeometry, linkedProps)); - linkedProps.clear(); linkedProps << "NewDataContainerName"; parameters.push_back(SIMPL_NEW_BOOL_FP("Update Origin", UpdateOrigin, FilterParameter::Parameter, CropImageGeometry)); parameters.push_back(SIMPL_NEW_LINKED_BOOL_FP("Save As New Data Container", SaveAsNewDataContainer, FilterParameter::Parameter, CropImageGeometry, linkedProps)); + parameters.push_back(SIMPL_NEW_STRING_FP("Data Container", NewDataContainerName, FilterParameter::CreatedArray, CropImageGeometry)); + parameters.push_back(SeparatorFilterParameter::New("Cell Data", FilterParameter::RequiredArray)); { AttributeMatrixSelectionFilterParameter::RequirementType req = AttributeMatrixSelectionFilterParameter::CreateRequirement(AttributeMatrix::Type::Cell, IGeometry::Type::Image); parameters.push_back(SIMPL_NEW_AM_SELECTION_FP("Cell Attribute Matrix", CellAttributeMatrixPath, FilterParameter::RequiredArray, CropImageGeometry, req)); } + + parameters.push_back(SeparatorFilterParameter::New("Renumber Features Parameters", FilterParameter::RequiredArray)); + linkedProps.clear(); + linkedProps << "CellFeatureAttributeMatrixPath" + << "FeatureIdsArrayPath"; + parameters.push_back(SIMPL_NEW_LINKED_BOOL_FP("Renumber Features", RenumberFeatures, FilterParameter::Parameter, CropImageGeometry, linkedProps)); { DataArraySelectionFilterParameter::RequirementType req = DataArraySelectionFilterParameter::CreateRequirement(SIMPL::TypeNames::Int32, 1, AttributeMatrix::Type::Cell, IGeometry::Type::Image); parameters.push_back(SIMPL_NEW_DA_SELECTION_FP("Feature Ids", FeatureIdsArrayPath, FilterParameter::RequiredArray, CropImageGeometry, req)); } - parameters.push_back(SeparatorFilterParameter::New("Cell Feature Data", FilterParameter::RequiredArray)); + //parameters.push_back(SeparatorFilterParameter::New("Cell Feature Data", FilterParameter::RequiredArray)); { AttributeMatrixSelectionFilterParameter::RequirementType req = AttributeMatrixSelectionFilterParameter::CreateRequirement(AttributeMatrix::Type::CellFeature, IGeometry::Type::Image); parameters.push_back(SIMPL_NEW_AM_SELECTION_FP("Cell Feature Attribute Matrix", CellFeatureAttributeMatrixPath, FilterParameter::RequiredArray, CropImageGeometry, req)); } - parameters.push_back(SIMPL_NEW_STRING_FP("Data Container", NewDataContainerName, FilterParameter::CreatedArray, CropImageGeometry)); setFilterParameters(parameters); } @@ -318,18 +321,29 @@ void CropImageGeometry::dataCheck() if(m_RenumberFeatures == true) { QVector cDims(1, 1); - m_FeatureIdsPtr = getDataContainerArray()->getPrereqArrayFromPath, AbstractFilter>(this, getFeatureIdsArrayPath(), - cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ - if(nullptr != m_FeatureIdsPtr.lock().get()) /* Validate the Weak Pointer wraps a non-nullptr pointer to a DataArray object */ + m_FeatureIdsPtr = getDataContainerArray()->getPrereqArrayFromPath, AbstractFilter>(nullptr, getFeatureIdsArrayPath(), cDims); + if(nullptr != m_FeatureIdsPtr.lock().get()) { m_FeatureIds = m_FeatureIdsPtr.lock()->getPointer(0); - } /* Now assign the raw pointer to data from the DataArray object */ + } + else + { + QString ss = + QObject::tr("The DataArray '%1' which defines the Feature Ids to renumber is invalid. Does it exist? Is it the correct type?").arg(getFeatureIdsArrayPath().serialize("/")); + setErrorCondition(-55500); + notifyErrorMessage(getHumanLabel(), ss, getErrorCondition()); + } - AttributeMatrix::Pointer cellFeatureAttrMat = srcCellDataContainer->getAttributeMatrix(getCellFeatureAttributeMatrixPath().getAttributeMatrixName()); + AttributeMatrix::Pointer cellFeatureAttrMat = srcCellDataContainer->getPrereqAttributeMatrix(nullptr, getCellFeatureAttributeMatrixPath().getAttributeMatrixName(), -56); if(nullptr == cellFeatureAttrMat.get()) { + QString ss = + QObject::tr("The AttributeMatrix '%1' is invalid. Does it exist? Is it the correct type?. The AttributeMatrix defines where the segmented features are stored.").arg(getCellFeatureAttributeMatrixPath().serialize("/")); + setErrorCondition(-55501); + notifyErrorMessage(getHumanLabel(), ss, getErrorCondition()); return; } + QVector activeObjects(cellFeatureAttrMat->getNumberOfTuples(), true); cellFeatureAttrMat->removeInactiveObjects(activeObjects, m_FeatureIdsPtr.lock()); }