Commit 76a98598 authored by Antoine Regimbeau's avatar Antoine Regimbeau

DOC: enhance code documentation

parent 7270cf16
......@@ -848,8 +848,25 @@ public:
this->SetDocLink(link);
}
/**
Register all ProcessObject that are linked to parameters :
\li ParameterType_OutputImage
\li ParameterType_OutputVectorData
Those ProcessObjects are stored in the m_Filters set and are deleted at the
end of ExecuteAndWriteOutput (if there are only held by the set)
This method can be called just before the end of a DoExecute in a derived
class of Application.
*/
void RegisterPipeline();
/**
Register all DataObject that are reachable from :
\li ParameterType_OutputImage
\li ParameterType_OutputVectorData
Once registered, the methode ReleaseData is called on each one of them.
*/
void FreeRessources();
protected:
......
......@@ -388,6 +388,7 @@ Application::RegisterPipeline()
std::stack< itk::DataObject * > dataStack;
std::set< itk::DataObject * > inputData;
std::vector<std::string> paramList = GetParametersKeys(true);
// Get both end of the pipeline
for ( key : paramList )
{
if ( GetParameterType(key) == ParameterType_OutputImage )
......@@ -511,6 +512,7 @@ void Application::FreeRessources()
{
std::set< itk::DataObject * > dataSet;
std::vector<std::string> paramList = GetParametersKeys(true);
// Get the end of the pipeline
for (std::vector<std::string>::const_iterator it = paramList.begin();
it != paramList.end();
++it)
......@@ -535,7 +537,7 @@ void Application::FreeRessources()
else
continue;
}
// DFS
// initialize DFS
std::stack< itk::ProcessObject * > processStack;
for ( auto data : dataSet )
{
......@@ -543,19 +545,23 @@ void Application::FreeRessources()
if ( process )
processStack.push( process );
}
// DFS
while ( !processStack.empty() )
{
itk::ProcessObject * current = processStack.top();
processStack.pop();
std::cout<<current->GetNameOfClass()<<std::endl;
// if null continue
if ( !current )
continue;
// Get all inputs
auto inputVector = current->GetInputs();
for ( auto data : inputVector )
{
// If input is null or already in the set continue
if ( !data.GetPointer() || dataSet.count( data.GetPointer() ) )
continue;
// If input is a list
if ( dynamic_cast< ObjectListInterface *> (data.GetPointer()) )
{
ObjectListInterface * list =
......@@ -581,13 +587,13 @@ void Application::FreeRessources()
}
}
}
// Release data
for ( auto data : dataSet )
{
std::cout<<"one bulk is freed"<<std::endl;
data->ReleaseData();
}
// Call overrode method
DoFreeRessources();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment