Skip to content
Snippets Groups Projects
Commit 0e6094dc authored by Floris Berendsen's avatar Floris Berendsen
Browse files

ENH: Component accepts settings, e.g. Sigma, via Criteria

parent 19da9330
No related branches found
No related tags found
No related merge requests found
......@@ -97,6 +97,28 @@ ItkSmoothingRecursiveGaussianImageFilterComponent< Dimensionality, TPixel>
}
}
else if (criterion.first == "Sigma") //Supports this?
{
if (criterion.second.size() != 1)
{
meetsCriteria = false;
//itkExceptionMacro("The criterion Sigma may have only 1 value");
}
else
{
auto const & criterionValue = *criterion.second.begin();
try
{
this->m_theItkFilter->SetSigma(std::stod(criterionValue));
meetsCriteria = true;
}
catch (itk::ExceptionObject & err)
{
//TODO log the error message?
meetsCriteria = false;
}
}
}
return meetsCriteria;
}
......
......@@ -9,7 +9,7 @@ namespace selx
// For testing purposes, all Sources are connected to an ImageReader
this->m_reader = itk::ImageFileReader<itk::Image<double, 3>>::New();
this->m_reader->SetFileName("e:/data/smalltest/small3d.mhd");
this->m_reader->SetFileName("e:/data/smalltest/3dSmiley.mhd");
// For testing purposes, all Sources are connected to an ImageWriter
this->m_writer = itk::ImageFileWriter<itk::Image<double, 3>>::New();
......
......@@ -50,6 +50,9 @@ public:
componentParameters["Dimensionality"] = ParameterValueType(1, "3");
componentParameters["PixelType"] = ParameterValueType(1, "double");
// Setting of the component are considered as criteria too. If the components can interpret the parameters, it's all good.
componentParameters["Sigma"] = ParameterValueType(1, "2.5");
ComponentIndexType index0 = blueprint->AddComponent(componentParameters);
ComponentIndexType index1 = blueprint->AddComponent(componentParameters);
......@@ -92,7 +95,6 @@ public:
// Read the blueprint and try to realize all components
// If for any node no components could be selected an exception is thrown.
allUniqueComponents = overlord->Configure();
EXPECT_NO_THROW(allUniqueComponents = overlord->Configure());
// If for any node multiple components are selected, allUniqueComponents is false.
EXPECT_TRUE(allUniqueComponents);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment