// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindBoundingBoxFeatures::readFilterParameters(AbstractFilterParametersReader* reader, int index) { reader->openFilterGroup(this, index); setCalcByPhase(reader->readValue("CalcByPhase", getCalcByPhase())); setPhasesArrayPath(reader->readDataArrayPath("PhasesArrayPath", getPhasesArrayPath())); setBiasedFeaturesArrayName(reader->readString("BiasedFeaturesArrayName", getBiasedFeaturesArrayName() ) ); setSurfaceFeaturesArrayPath(reader->readDataArrayPath("SurfaceFeaturesArrayPath", getSurfaceFeaturesArrayPath() ) ); setCentroidsArrayPath(reader->readDataArrayPath("CentroidsArrayPath", getCentroidsArrayPath() ) ); reader->closeFilterGroup(); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindBoundingBoxFeatures::execute() { setErrorCondition(0); dataCheck(); if(getErrorCondition() < 0) { return; } DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getCentroidsArrayPath().getDataContainerName()); if(m->getGeometryAs<ImageGeom>()->getXPoints() > 1 && m->getGeometryAs<ImageGeom>()->getYPoints() > 1 && m->getGeometryAs<ImageGeom>()->getZPoints() > 1) { find_boundingboxfeatures(); } if(m->getGeometryAs<ImageGeom>()->getXPoints() == 1 || m->getGeometryAs<ImageGeom>()->getYPoints() == 1 || m->getGeometryAs<ImageGeom>()->getZPoints() == 1) { find_boundingboxfeatures2D(); } notifyStatusMessage(getHumanLabel(), "Complete"); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindBoundingBoxFeatures::dataCheck() { setErrorCondition(0); DataArrayPath tempPath; getDataContainerArray()->getPrereqGeometryFromDataContainer<ImageGeom, AbstractFilter>(this, getCentroidsArrayPath().getDataContainerName()); QVector<DataArrayPath> dataArrayPaths; QVector<size_t> cDims(1, 3); m_CentroidsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<float>, AbstractFilter>(this, getCentroidsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_CentroidsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_Centroids = m_CentroidsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ if(getErrorCondition() >= 0) { dataArrayPaths.push_back(getCentroidsArrayPath()); } cDims[0] = 1; m_SurfaceFeaturesPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<bool>, AbstractFilter>(this, getSurfaceFeaturesArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_SurfaceFeaturesPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_SurfaceFeatures = m_SurfaceFeaturesPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ if(getErrorCondition() >= 0) { dataArrayPaths.push_back(getSurfaceFeaturesArrayPath()); } tempPath.update(getCentroidsArrayPath().getDataContainerName(), getCentroidsArrayPath().getAttributeMatrixName(), getBiasedFeaturesArrayName() ); m_BiasedFeaturesPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<bool>, AbstractFilter, bool>(this, tempPath, false, cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_BiasedFeaturesPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_BiasedFeatures = m_BiasedFeaturesPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ if (getCalcByPhase() == true) { m_PhasesPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getPhasesArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_PhasesPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_Phases = m_PhasesPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ if(getErrorCondition() >= 0) { dataArrayPaths.push_back(getPhasesArrayPath()); } } getDataContainerArray()->validateNumberOfTuples(this, dataArrayPaths); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindEllipsoidError::readFilterParameters(AbstractFilterParametersReader* reader, int index) { reader->openFilterGroup(this, index); setCellFeatureAttributeMatrixName(reader->readDataArrayPath("CellFeatureAttributeMatrixName", getCellFeatureAttributeMatrixName())); setCentroidsArrayPath(reader->readDataArrayPath("CentroidsArrayPath", getCentroidsArrayPath() ) ); setFeatureIdsArrayPath(reader->readDataArrayPath("FeatureIdsArrayPath", getFeatureIdsArrayPath() ) ); setAxisEulerAnglesArrayPath(reader->readDataArrayPath("AxisEulerAnglesArrayPath", getAxisEulerAnglesArrayPath())); setNumCellsArrayPath(reader->readDataArrayPath("NumCellsArrayPath", getNumCellsArrayPath())); setAxisLengthsArrayPath(reader->readDataArrayPath("AxisLengthsArrayPath", getAxisLengthsArrayPath())); setIdealFeatureIdsArrayName(reader->readString("IdealFeatureIdsArrayName", getIdealFeatureIdsArrayName() ) ); setEllipsoidErrorArrayName(reader->readString("EllipsoidErrrorArrayName", getEllipsoidErrorArrayName() ) ); setWriteIdealEllipseFeatureIds(reader->readValue("WriteIdealEllipseFeatureIds", getWriteIdealEllipseFeatureIds() ) ); reader->closeFilterGroup(); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindFeatureClustering::readFilterParameters(AbstractFilterParametersReader* reader, int index) { reader->openFilterGroup(this, index); setCellEnsembleAttributeMatrixName(reader->readDataArrayPath("CellEnsembleAttributeMatrixName", getCellEnsembleAttributeMatrixName() ) ); setNumberOfBins( reader->readValue( "NumberOfBins", getNumberOfBins() ) ); setNewEnsembleArrayArrayName(reader->readString("NewEnsembleArrayArrayName", getNewEnsembleArrayArrayName() ) ); setMaxMinArrayName(reader->readString("MaxMinArrayName", getMaxMinArrayName() ) ); setClusteringListArrayName(reader->readString("ClusteringListArrayName", getClusteringListArrayName() ) ); setCentroidsArrayPath(reader->readDataArrayPath("CentroidsArrayPath", getCentroidsArrayPath() ) ); setFeaturePhasesArrayPath(reader->readDataArrayPath("FeaturePhasesArrayPath", getFeaturePhasesArrayPath() ) ); setEquivalentDiametersArrayPath(reader->readDataArrayPath("EquivalentDiametersArrayPath", getEquivalentDiametersArrayPath() ) ); setPhaseNumber( reader->readValue("PhaseNumber", getPhaseNumber() ) ); setBiasedFeaturesArrayPath(reader->readDataArrayPath("BiasedFeaturesArrayPath", getBiasedFeaturesArrayPath() ) ); setRemoveBiasedFeatures( reader->readValue( "RemoveBiasedFeatures", getRemoveBiasedFeatures() ) ); reader->closeFilterGroup(); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindBoundingBoxFeatures::setupFilterParameters() { FilterParameterVector parameters; QStringList linkedProps("PhasesArrayPath"); parameters.push_back(LinkedBooleanFilterParameter::New("Apply Phase by Phase", "CalcByPhase", getCalcByPhase(), linkedProps, FilterParameter::Parameter)); parameters.push_back(SeparatorFilterParameter::New("Cell Feature Data", FilterParameter::RequiredArray)); { DataArraySelectionFilterParameter::RequirementType req = DataArraySelectionFilterParameter::CreateRequirement(DREAM3D::TypeNames::Float, 3, DREAM3D::AttributeMatrixType::CellFeature, DREAM3D::GeometryType::ImageGeometry); parameters.push_back(DataArraySelectionFilterParameter::New("Centroids", "CentroidsArrayPath", getCentroidsArrayPath(), FilterParameter::RequiredArray, req)); } { DataArraySelectionFilterParameter::RequirementType req = DataArraySelectionFilterParameter::CreateRequirement(DREAM3D::TypeNames::Bool, 1, DREAM3D::AttributeMatrixType::CellFeature, DREAM3D::GeometryType::ImageGeometry); parameters.push_back(DataArraySelectionFilterParameter::New("Surface Features", "SurfaceFeaturesArrayPath", getSurfaceFeaturesArrayPath(), FilterParameter::RequiredArray, req)); } { DataArraySelectionFilterParameter::RequirementType req = DataArraySelectionFilterParameter::CreateRequirement(DREAM3D::TypeNames::Int32, 1, DREAM3D::AttributeMatrixType::CellFeature, DREAM3D::GeometryType::ImageGeometry); parameters.push_back(DataArraySelectionFilterParameter::New("Phases", "PhasesArrayPath", getPhasesArrayPath(), FilterParameter::RequiredArray, req)); } parameters.push_back(SeparatorFilterParameter::New("Cell Feature Data", FilterParameter::CreatedArray)); parameters.push_back(StringFilterParameter::New("Biased Features", "BiasedFeaturesArrayName", getBiasedFeaturesArrayName(), FilterParameter::CreatedArray)); setFilterParameters(parameters); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindBoundingBoxFeatures::find_boundingboxfeatures2D() { DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getCentroidsArrayPath().getDataContainerName()); size_t size = m_CentroidsPtr.lock()->getNumberOfTuples(); float boundbox[5] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; float coords[5] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; float x = 0.0f; float y = 0.0f; float dist[5] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; float mindist = std::numeric_limits<float>::max(); int32_t sidetomove = 0; int32_t move = 0; int32_t xPoints = 0, yPoints = 0; float xRes = 0.0f, yRes = 0.0f; if (m->getGeometryAs<ImageGeom>()->getXPoints() == 1) { xPoints = m->getGeometryAs<ImageGeom>()->getYPoints(); xRes = m->getGeometryAs<ImageGeom>()->getYRes(); yPoints = m->getGeometryAs<ImageGeom>()->getZPoints(); yRes = m->getGeometryAs<ImageGeom>()->getZRes(); } if (m->getGeometryAs<ImageGeom>()->getYPoints() == 1) { xPoints = m->getGeometryAs<ImageGeom>()->getXPoints(); xRes = m->getGeometryAs<ImageGeom>()->getXRes(); yPoints = m->getGeometryAs<ImageGeom>()->getZPoints(); yRes = m->getGeometryAs<ImageGeom>()->getZRes(); } if (m->getGeometryAs<ImageGeom>()->getZPoints() == 1) { xPoints = m->getGeometryAs<ImageGeom>()->getXPoints(); xRes = m->getGeometryAs<ImageGeom>()->getXRes(); yPoints = m->getGeometryAs<ImageGeom>()->getYPoints(); yRes = m->getGeometryAs<ImageGeom>()->getYRes(); } boundbox[1] = 0; boundbox[2] = xPoints * xRes; boundbox[3] = 0; boundbox[4] = yPoints * yRes; for (size_t i = 1; i < size; i++) { if(m_SurfaceFeatures[i] == true) { move = 1; mindist = std::numeric_limits<float>::max(); x = m_Centroids[3 * i]; y = m_Centroids[3 * i + 1]; coords[1] = x; coords[2] = x; coords[3] = y; coords[4] = y; for(int32_t j = 1; j < 5; j++) { dist[j] = std::numeric_limits<float>::max(); if(j % 2 == 1) { if(coords[j] > boundbox[j]) { dist[j] = (coords[j] - boundbox[j]); } if(coords[j] <= boundbox[j]) { move = 0; } } if(j % 2 == 0) { if(coords[j] < boundbox[j]) { dist[j] = (boundbox[j] - coords[j]); } if(coords[j] >= boundbox[j]) { move = 0; } } if(dist[j] < mindist) { mindist = dist[j], sidetomove = j; } } if(move == 1) { boundbox[sidetomove] = coords[sidetomove]; } } } for (size_t j = 1; j < size; j++) { if(m_Centroids[3 * j] <= boundbox[1]) { m_BiasedFeatures[j] = true; } if(m_Centroids[3 * j] >= boundbox[2]) { m_BiasedFeatures[j] = true; } if(m_Centroids[3 * j + 1] <= boundbox[3]) { m_BiasedFeatures[j] = true; } if(m_Centroids[3 * j + 1] >= boundbox[4]) { m_BiasedFeatures[j] = true; } } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindBoundingBoxFeatures::find_boundingboxfeatures() { DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getCentroidsArrayPath().getDataContainerName()); size_t size = m_CentroidsPtr.lock()->getNumberOfTuples(); float boundbox[7] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }; float coords[7] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }; float x = 0.0f; float y = 0.0f; float z = 0.0f; float dist[7] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }; float mindist = std::numeric_limits<float>::max(); int32_t sidetomove = 0; int32_t move = 0; // loop first to determine number of phases if calcByPhase is being used int32_t numPhases = 1; if (m_CalcByPhase == true) { for (size_t i = 1; i < size; i++) { if (m_Phases[i] > numPhases) { numPhases = m_Phases[i]; } } } for (int32_t iter = 1; iter <= numPhases; iter++) { if (m_CalcByPhase == true) { QString ss = QObject::tr("Working on Phase %1 of %2").arg(iter).arg(numPhases); notifyStatusMessage(getMessagePrefix(), getHumanLabel(), ss); } // reset boundbox for each phase boundbox[1] = 0; boundbox[2] = m->getGeometryAs<ImageGeom>()->getXPoints() * m->getGeometryAs<ImageGeom>()->getXRes(); boundbox[3] = 0; boundbox[4] = m->getGeometryAs<ImageGeom>()->getYPoints() * m->getGeometryAs<ImageGeom>()->getYRes(); boundbox[5] = 0; boundbox[6] = m->getGeometryAs<ImageGeom>()->getZPoints() * m->getGeometryAs<ImageGeom>()->getZRes(); for (size_t i = 1; i < size; i++) { if (m_SurfaceFeatures[i] == true && (m_CalcByPhase == false || m_Phases[i] == iter)) { move = 1; mindist = std::numeric_limits<float>::max(); x = m_Centroids[3 * i]; y = m_Centroids[3 * i + 1]; z = m_Centroids[3 * i + 2]; coords[1] = x; coords[2] = x; coords[3] = y; coords[4] = y; coords[5] = z; coords[6] = z; for (int32_t j = 1; j < 7; j++) { dist[j] = std::numeric_limits<float>::max(); if (j % 2 == 1) { if (coords[j] > boundbox[j]) { dist[j] = (coords[j] - boundbox[j]); } if (coords[j] <= boundbox[j]) { move = 0; } } if (j % 2 == 0) { if (coords[j] < boundbox[j]) { dist[j] = (boundbox[j] - coords[j]); } if (coords[j] >= boundbox[j]) { move = 0; } } if (dist[j] < mindist) { mindist = dist[j], sidetomove = j; } } if (move == 1) { boundbox[sidetomove] = coords[sidetomove]; } } } for (size_t j = 1; j < size; j++) { if (m_CalcByPhase == false || m_Phases[j] == iter) { if (m_Centroids[3 * j] <= boundbox[1]) { m_BiasedFeatures[j] = true; } if (m_Centroids[3 * j] >= boundbox[2]) { m_BiasedFeatures[j] = true; } if (m_Centroids[3 * j + 1] <= boundbox[3]) { m_BiasedFeatures[j] = true; } if (m_Centroids[3 * j + 1] >= boundbox[4]) { m_BiasedFeatures[j] = true; } if (m_Centroids[3 * j + 2] <= boundbox[5]) { m_BiasedFeatures[j] = true; } if (m_Centroids[3 * j + 2] >= boundbox[6]) { m_BiasedFeatures[j] = true; } } } } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindEllipsoidError::setupFilterParameters() { FilterParameterVector parameters; QStringList linkedProps("IdealFeatureIdsArrayName"); parameters.push_back(LinkedBooleanFilterParameter::New("Write Ideal Ellipse Feature Ids (Caution LONG calculation)", "WriteIdealEllipseFeatureIds", getWriteIdealEllipseFeatureIds(), linkedProps, FilterParameter::Parameter)); { DataArraySelectionFilterParameter::RequirementType req; parameters.push_back(DataArraySelectionFilterParameter::New("FeatureIds", "FeatureIdsArrayPath", getFeatureIdsArrayPath(), FilterParameter::RequiredArray, req)); } { DataArraySelectionFilterParameter::RequirementType req; parameters.push_back(DataArraySelectionFilterParameter::New("Centroids", "CentroidsArrayPath", getCentroidsArrayPath(), FilterParameter::RequiredArray, req)); } { DataArraySelectionFilterParameter::RequirementType req; parameters.push_back(DataArraySelectionFilterParameter::New("NumCells", "NumCellsArrayPath", getNumCellsArrayPath(), FilterParameter::RequiredArray, req)); } { DataArraySelectionFilterParameter::RequirementType req; parameters.push_back(DataArraySelectionFilterParameter::New("Axis Eulers", "AxisEulerAnglesArrayPath", getAxisEulerAnglesArrayPath(), FilterParameter::RequiredArray, req)); } { DataArraySelectionFilterParameter::RequirementType req; parameters.push_back(DataArraySelectionFilterParameter::New("AxisLengths", "AxisLengthsArrayPath", getAxisLengthsArrayPath(), FilterParameter::RequiredArray, req)); } { AttributeMatrixSelectionFilterParameter::RequirementType req = AttributeMatrixSelectionFilterParameter::CreateRequirement(DREAM3D::AttributeMatrixType::CellFeature, DREAM3D::GeometryType::ImageGeometry); parameters.push_back(AttributeMatrixSelectionFilterParameter::New("Cell Feature Attribute Matrix Name", "CellFeatureAttributeMatrixName", getCellFeatureAttributeMatrixName(), FilterParameter::RequiredArray, req)); } parameters.push_back(StringFilterParameter::New("EllipsoidError", "EllipsoidErrorArrayName", getEllipsoidErrorArrayName(), FilterParameter::CreatedArray)); parameters.push_back(StringFilterParameter::New("IdealFeatureIds", "IdealFeatureIdsArrayName", getIdealFeatureIdsArrayName(), FilterParameter::CreatedArray)); setFilterParameters(parameters); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindEllipsoidError::dataCheck() { DataArrayPath tempPath; setErrorCondition(0); QVector<size_t> dims(1, 1); m_FeatureIdsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getFeatureIdsArrayPath(), dims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_FeatureIdsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_FeatureIds = m_FeatureIdsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ if(getErrorCondition() < 0) { return; } ImageGeom::Pointer image = getDataContainerArray()->getDataContainer(getFeatureIdsArrayPath().getDataContainerName())->getPrereqGeometry<ImageGeom, AbstractFilter>(this); if(getErrorCondition() < 0 || NULL == image.get()) { return; } dims[0] = 3; m_CentroidsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<float>, AbstractFilter>(this, getCentroidsArrayPath(), dims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_CentroidsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_Centroids = m_CentroidsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ dims[0] = 3; m_AxisEulerAnglesPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<float>, AbstractFilter>(this, getAxisEulerAnglesArrayPath(), dims); if( NULL != m_AxisEulerAnglesPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_AxisEulerAngles = m_AxisEulerAnglesPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ dims[0] = 3; m_AxisLengthsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<float>, AbstractFilter>(this, getAxisLengthsArrayPath(), dims); if( NULL != m_AxisLengthsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_AxisLengths = m_AxisLengthsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ dims[0] = 1; m_NumCellsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getNumCellsArrayPath(), dims); if( NULL != m_NumCellsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_NumCells = m_NumCellsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ if (m_WriteIdealEllipseFeatureIds == true) { dims[0] = 1; tempPath.update(m_FeatureIdsArrayPath.getDataContainerName(), m_FeatureIdsArrayPath.getAttributeMatrixName(), getIdealFeatureIdsArrayName() ); m_IdealFeatureIdsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter, int32_t>(this, tempPath, 0, dims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_IdealFeatureIdsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_IdealFeatureIds = m_IdealFeatureIdsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ } dims[0] = 1; tempPath.update(m_NumCellsArrayPath.getDataContainerName(), m_NumCellsArrayPath.getAttributeMatrixName(), getEllipsoidErrorArrayName() ); m_EllipsoidErrorPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter, float>(this, tempPath, 0, dims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_EllipsoidErrorPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_EllipsoidError = m_EllipsoidErrorPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindFeatureClustering::setupFilterParameters() { FilterParameterVector parameters; parameters.push_back(IntFilterParameter::New("Number of Bins for RDF", "NumberOfBins", getNumberOfBins(), FilterParameter::Parameter)); parameters.push_back(IntFilterParameter::New("Phase Index", "PhaseNumber", getPhaseNumber(), FilterParameter::Parameter)); QStringList linkedProps("BiasedFeaturesArrayPath"); parameters.push_back(LinkedBooleanFilterParameter::New("Remove Biased Features", "RemoveBiasedFeatures", getRemoveBiasedFeatures(), linkedProps, FilterParameter::Parameter)); parameters.push_back(SeparatorFilterParameter::New("Cell Feature Data", FilterParameter::RequiredArray)); { DataArraySelectionFilterParameter::RequirementType req = DataArraySelectionFilterParameter::CreateRequirement(SIMPL::TypeNames::Float, 1, SIMPL::AttributeMatrixType::CellFeature, SIMPL::GeometryType::ImageGeometry); parameters.push_back(DataArraySelectionFilterParameter::New("Equivalent Diameters", "EquivalentDiametersArrayPath", getEquivalentDiametersArrayPath(), FilterParameter::RequiredArray, req)); } { DataArraySelectionFilterParameter::RequirementType req = DataArraySelectionFilterParameter::CreateRequirement(SIMPL::TypeNames::Int32, 1, SIMPL::AttributeMatrixType::CellFeature, SIMPL::GeometryType::ImageGeometry); parameters.push_back(DataArraySelectionFilterParameter::New("Phases", "FeaturePhasesArrayPath", getFeaturePhasesArrayPath(), FilterParameter::RequiredArray, req)); } { DataArraySelectionFilterParameter::RequirementType req = DataArraySelectionFilterParameter::CreateRequirement(SIMPL::TypeNames::Float, 3, SIMPL::AttributeMatrixType::CellFeature, SIMPL::GeometryType::ImageGeometry); parameters.push_back(DataArraySelectionFilterParameter::New("Centroids", "CentroidsArrayPath", getCentroidsArrayPath(), FilterParameter::RequiredArray, req)); } { DataArraySelectionFilterParameter::RequirementType req = DataArraySelectionFilterParameter::CreateRequirement(SIMPL::TypeNames::Bool, 1, SIMPL::AttributeMatrixType::CellFeature, SIMPL::GeometryType::ImageGeometry); parameters.push_back(DataArraySelectionFilterParameter::New("Biased Features", "BiasedFeaturesArrayPath", getBiasedFeaturesArrayPath(), FilterParameter::RequiredArray, req)); } parameters.push_back(SeparatorFilterParameter::New("Cell Ensemble Data", FilterParameter::RequiredArray)); { AttributeMatrixSelectionFilterParameter::RequirementType amReq = AttributeMatrixSelectionFilterParameter::CreateRequirement(SIMPL::AttributeMatrixType::CellEnsemble, SIMPL::GeometryType::ImageGeometry); parameters.push_back(AttributeMatrixSelectionFilterParameter::New("Cell Ensemble Attribute Matrix", "CellEnsembleAttributeMatrixName", getCellEnsembleAttributeMatrixName(), FilterParameter::RequiredArray, amReq)); } parameters.push_back(SeparatorFilterParameter::New("Cell Feature Data", FilterParameter::CreatedArray)); parameters.push_back(StringFilterParameter::New("Clustering List", "ClusteringListArrayName", getClusteringListArrayName(), FilterParameter::CreatedArray)); parameters.push_back(SeparatorFilterParameter::New("Cell Ensemble Data", FilterParameter::CreatedArray)); parameters.push_back(StringFilterParameter::New("Radial Distribution Function", "NewEnsembleArrayArrayName", getNewEnsembleArrayArrayName(), FilterParameter::CreatedArray)); parameters.push_back(StringFilterParameter::New("Max and Min Separation Distances", "MaxMinArrayName", getMaxMinArrayName(), FilterParameter::CreatedArray)); setFilterParameters(parameters); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindFeatureClustering::dataCheck() { setErrorCondition(0); initialize(); getDataContainerArray()->getPrereqGeometryFromDataContainer<ImageGeom, AbstractFilter>(this, getEquivalentDiametersArrayPath().getDataContainerName()); DataArrayPath tempPath; QVector<size_t> cDims(1, 1); m_EquivalentDiametersPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<float>, AbstractFilter>(this, getEquivalentDiametersArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_EquivalentDiametersPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_EquivalentDiameters = m_EquivalentDiametersPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ m_FeaturePhasesPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getFeaturePhasesArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_FeaturePhasesPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_FeaturePhases = m_FeaturePhasesPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ cDims[0] = 3; m_CentroidsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<float>, AbstractFilter>(this, getCentroidsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_CentroidsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_Centroids = m_CentroidsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ if (m_RemoveBiasedFeatures == true) { cDims[0] = 1; m_BiasedFeaturesPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<bool>, AbstractFilter>(this, getBiasedFeaturesArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_BiasedFeaturesPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_BiasedFeatures = m_BiasedFeaturesPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ } cDims[0] = m_NumberOfBins; tempPath.update(getCellEnsembleAttributeMatrixName().getDataContainerName(), getCellEnsembleAttributeMatrixName().getAttributeMatrixName(), getNewEnsembleArrayArrayName() ); m_NewEnsembleArrayPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter>(this, tempPath, 0, cDims); /* Assigns the shared_ptr<>(this, tempPath, 0, dims); Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ if( NULL != m_NewEnsembleArrayPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_NewEnsembleArray = m_NewEnsembleArrayPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ cDims[0] = 2; tempPath.update(getCellEnsembleAttributeMatrixName().getDataContainerName(), getCellEnsembleAttributeMatrixName().getAttributeMatrixName(), getMaxMinArrayName() ); m_MaxMinArrayPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter>(this, tempPath, 0, cDims); if( NULL != m_MaxMinArrayPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */ { m_MaxMinArray = m_MaxMinArrayPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */ cDims[0] = 1; tempPath.update(getFeaturePhasesArrayPath().getDataContainerName(), getFeaturePhasesArrayPath().getAttributeMatrixName(), getClusteringListArrayName() ); m_ClusteringList = getDataContainerArray()->createNonPrereqArrayFromPath<NeighborList<float>, AbstractFilter, float>(this, tempPath, 0, cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */ }