Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: DataPath::replaceName convenience method. #928

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading