Skip to content

Commit

Permalink
API: DataPath::replaceName convenience method. (BlueQuartzSoftware#928)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson committed Apr 25, 2024
1 parent 6a936c3 commit be752c2
Show file tree
Hide file tree
Showing 126 changed files with 299 additions and 283 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class IOHandler

// rename grayscale array to reflect original
{
auto& gray = m_DataStructure.getDataRefAs<IDataArray>(imageDataPath.getParent().createChildPath("gray" + imageDataPath.getTargetName()));
auto& gray = m_DataStructure.getDataRefAs<IDataArray>(imageDataPath.replaceName("gray" + imageDataPath.getTargetName()));
if(!gray.canRename(imageDataPath.getTargetName()))
{
return MakeErrorResult(-18543, fmt::format("Unable to rename the grayscale array to {}", imageDataPath.getTargetName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ IFilter::PreflightResult ITKAbsImage::preflightImpl(const DataStructure& dataStr
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKAbsImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -106,7 +106,7 @@ Result<> ITKAbsImage::executeImpl(DataStructure& dataStructure, const Arguments&
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

const cxITKAbsImage::ITKAbsImageFunctor itkFunctor = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ IFilter::PreflightResult ITKAcosImage::preflightImpl(const DataStructure& dataSt
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKAcosImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -106,7 +106,7 @@ Result<> ITKAcosImage::executeImpl(DataStructure& dataStructure, const Arguments
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

const cxITKAcosImage::ITKAcosImageFunctor itkFunctor = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ IFilter::PreflightResult ITKAdaptiveHistogramEqualizationImage::preflightImpl(co

auto alpha = filterArgs.value<float32>(k_Alpha_Key);
auto beta = filterArgs.value<float32>(k_Beta_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKAdaptiveHistogramEqualizationImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -134,7 +134,7 @@ Result<> ITKAdaptiveHistogramEqualizationImage::executeImpl(DataStructure& dataS
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

auto radius = filterArgs.value<VectorUInt32Parameter::ValueType>(k_Radius_Key);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ IFilter::PreflightResult ITKApproximateSignedDistanceMapImage::preflightImpl(con
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
auto insideValue = filterArgs.value<float64>(k_InsideValue_Key);
auto outsideValue = filterArgs.value<float64>(k_OutsideValue_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKApproximateSignedDistanceMapImage::ArrayOptionsType, cxITKApproximateSignedDistanceMapImage::FilterOutputType>(
dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);
Expand All @@ -118,7 +118,7 @@ Result<> ITKApproximateSignedDistanceMapImage::executeImpl(DataStructure& dataSt
auto imageGeomPath = filterArgs.value<DataPath>(k_SelectedImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_SelectedImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

auto insideValue = filterArgs.value<float64>(k_InsideValue_Key);
auto outsideValue = filterArgs.value<float64>(k_OutsideValue_Key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ IFilter::PreflightResult ITKAsinImage::preflightImpl(const DataStructure& dataSt
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKAsinImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -106,7 +106,7 @@ Result<> ITKAsinImage::executeImpl(DataStructure& dataStructure, const Arguments
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

const cxITKAsinImage::ITKAsinImageFunctor itkFunctor = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ IFilter::PreflightResult ITKAtanImage::preflightImpl(const DataStructure& dataSt
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKAtanImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -106,7 +106,7 @@ Result<> ITKAtanImage::executeImpl(DataStructure& dataStructure, const Arguments
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

const cxITKAtanImage::ITKAtanImageFunctor itkFunctor = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ IFilter::PreflightResult ITKBinaryContourImage::preflightImpl(const DataStructur
auto fullyConnected = filterArgs.value<bool>(k_FullyConnected_Key);
auto backgroundValue = filterArgs.value<float64>(k_BackgroundValue_Key);
auto foregroundValue = filterArgs.value<float64>(k_ForegroundValue_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKBinaryContourImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -125,7 +125,7 @@ Result<> ITKBinaryContourImage::executeImpl(DataStructure& dataStructure, const
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

auto fullyConnected = filterArgs.value<bool>(k_FullyConnected_Key);
auto backgroundValue = filterArgs.value<float64>(k_BackgroundValue_Key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ IFilter::PreflightResult ITKBinaryDilateImage::preflightImpl(const DataStructure
auto backgroundValue = filterArgs.value<float64>(k_BackgroundValue_Key);
auto foregroundValue = filterArgs.value<float64>(k_ForegroundValue_Key);
auto boundaryToForeground = filterArgs.value<bool>(k_BoundaryToForeground_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKBinaryDilateImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -134,7 +134,7 @@ Result<> ITKBinaryDilateImage::executeImpl(DataStructure& dataStructure, const A
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

auto kernelRadius = filterArgs.value<VectorParameter<uint32>::ValueType>(k_KernelRadius_Key);
auto kernelType = static_cast<itk::simple::KernelEnum>(filterArgs.value<uint64>(k_KernelType_Key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ IFilter::PreflightResult ITKBinaryErodeImage::preflightImpl(const DataStructure&
auto backgroundValue = filterArgs.value<float64>(k_BackgroundValue_Key);
auto foregroundValue = filterArgs.value<float64>(k_ForegroundValue_Key);
auto boundaryToForeground = filterArgs.value<bool>(k_BoundaryToForeground_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKBinaryErodeImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -134,7 +134,7 @@ Result<> ITKBinaryErodeImage::executeImpl(DataStructure& dataStructure, const Ar
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

auto kernelRadius = filterArgs.value<VectorParameter<uint32>::ValueType>(k_KernelRadius_Key);
auto kernelType = static_cast<itk::simple::KernelEnum>(filterArgs.value<uint64>(k_KernelType_Key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ IFilter::PreflightResult ITKBinaryMorphologicalClosingImage::preflightImpl(const
auto kernelType = static_cast<itk::simple::KernelEnum>(filterArgs.value<uint64>(k_KernelType_Key));
auto foregroundValue = filterArgs.value<float64>(k_ForegroundValue_Key);
auto safeBorder = filterArgs.value<bool>(k_SafeBorder_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKBinaryMorphologicalClosingImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -129,7 +129,7 @@ Result<> ITKBinaryMorphologicalClosingImage::executeImpl(DataStructure& dataStru
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

auto kernelRadius = filterArgs.value<VectorParameter<uint32>::ValueType>(k_KernelRadius_Key);
auto kernelType = static_cast<itk::simple::KernelEnum>(filterArgs.value<uint64>(k_KernelType_Key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ IFilter::PreflightResult ITKBinaryMorphologicalOpeningImage::preflightImpl(const
auto kernelType = static_cast<itk::simple::KernelEnum>(filterArgs.value<uint64>(k_KernelType_Key));
auto backgroundValue = filterArgs.value<float64>(k_BackgroundValue_Key);
auto foregroundValue = filterArgs.value<float64>(k_ForegroundValue_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKBinaryMorphologicalOpeningImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -129,7 +129,7 @@ Result<> ITKBinaryMorphologicalOpeningImage::executeImpl(DataStructure& dataStru
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

auto kernelRadius = filterArgs.value<VectorParameter<uint32>::ValueType>(k_KernelRadius_Key);
auto kernelType = static_cast<itk::simple::KernelEnum>(filterArgs.value<uint64>(k_KernelType_Key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ IFilter::PreflightResult ITKBinaryOpeningByReconstructionImage::preflightImpl(co
auto foregroundValue = filterArgs.value<float64>(k_ForegroundValue_Key);
auto backgroundValue = filterArgs.value<float64>(k_BackgroundValue_Key);
auto fullyConnected = filterArgs.value<bool>(k_FullyConnected_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKBinaryOpeningByReconstructionImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -137,7 +137,7 @@ Result<> ITKBinaryOpeningByReconstructionImage::executeImpl(DataStructure& dataS
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

auto kernelRadius = filterArgs.value<VectorParameter<uint32>::ValueType>(k_KernelRadius_Key);
auto kernelType = static_cast<itk::simple::KernelEnum>(filterArgs.value<uint64>(k_KernelType_Key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ IFilter::PreflightResult ITKBinaryProjectionImage::preflightImpl(const DataStruc
auto projectionDimension = filterArgs.value<uint32>(k_ProjectionDimension_Key);
auto foregroundValue = filterArgs.value<float64>(k_ForegroundValue_Key);
auto backgroundValue = filterArgs.value<float64>(k_BackgroundValue_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKBinaryProjectionImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -126,7 +126,7 @@ Result<> ITKBinaryProjectionImage::executeImpl(DataStructure& dataStructure, con
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

auto projectionDimension = filterArgs.value<uint32>(k_ProjectionDimension_Key);
auto foregroundValue = filterArgs.value<float64>(k_ForegroundValue_Key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ IFilter::PreflightResult ITKBinaryThinningImage::preflightImpl(const DataStructu
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

Result<OutputActions> resultOutputActions = ITK::DataCheck<cxITKBinaryThinningImage::ArrayOptionsType>(dataStructure, selectedInputArray, imageGeomPath, outputArrayPath);

Expand All @@ -106,7 +106,7 @@ Result<> ITKBinaryThinningImage::executeImpl(DataStructure& dataStructure, const
auto imageGeomPath = filterArgs.value<DataPath>(k_InputImageGeomPath_Key);
auto selectedInputArray = filterArgs.value<DataPath>(k_InputImageDataPath_Key);
auto outputArrayName = filterArgs.value<DataObjectNameParameter::ValueType>(k_OutputImageArrayName_Key);
const DataPath outputArrayPath = selectedInputArray.getParent().createChildPath(outputArrayName);
const DataPath outputArrayPath = selectedInputArray.replaceName(outputArrayName);

const cxITKBinaryThinningImage::ITKBinaryThinningImageFunctor itkFunctor = {};

Expand Down
Loading

0 comments on commit be752c2

Please sign in to comment.