Skip to content

Commit

Permalink
refactoring for release 1.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
stnava committed Jul 13, 2010
1 parent 35a8adf commit 207d7e4
Show file tree
Hide file tree
Showing 25 changed files with 60 additions and 3,175 deletions.
21 changes: 10 additions & 11 deletions Examples/ANTSConformalMapping.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "itkCommandLineOption.h"
#include "itkCommandLineParser.h"
#include "antsCommandLineParser.h"
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
Expand Down Expand Up @@ -56,9 +55,9 @@ class CommandIterationUpdate : public itk::Command
}
};

void InitializeCommandLineOptions( itk::CommandLineParser *parser )
void InitializeCommandLineOptions( itk::ants::CommandLineParser *parser )
{
typedef itk::CommandLineParser::OptionType OptionType;
typedef itk::ants::CommandLineParser::OptionType OptionType;

{
std::string description =
Expand Down Expand Up @@ -191,7 +190,7 @@ void InitializeCommandLineOptions( itk::CommandLineParser *parser )
}

template <unsigned int ImageDimension>
int ANTSConformalMapping( itk::CommandLineParser *parser )
int ANTSConformalMapping( itk::ants::CommandLineParser *parser )
{
typedef float PixelType;
typedef float RealType;
Expand All @@ -212,7 +211,7 @@ int ANTSConformalMapping( itk::CommandLineParser *parser )
// first find out if the user wants to inflate the mesh ...
unsigned int inflate_iterations = 0;
float inflate_param = 0;
typename itk::CommandLineParser::OptionType::Pointer infOption =
typename itk::ants::CommandLineParser::OptionType::Pointer infOption =
parser->GetOption( "inflate" );
if( infOption && infOption->GetNumberOfValues() > 0 )
{
Expand All @@ -232,7 +231,7 @@ int ANTSConformalMapping( itk::CommandLineParser *parser )
}

float maxCost = 40, distCostW = 1, labelCostW = 0;
typename itk::CommandLineParser::OptionType::Pointer costOption =
typename itk::ants::CommandLineParser::OptionType::Pointer costOption =
parser->GetOption( "segmentation-cost" );
if( costOption && costOption->GetNumberOfValues() > 0 )
{
Expand All @@ -250,7 +249,7 @@ int ANTSConformalMapping( itk::CommandLineParser *parser )
}
}

typename itk::CommandLineParser::OptionType::Pointer displayOption = parser->GetOption( "display-mesh" );
typename itk::ants::CommandLineParser::OptionType::Pointer displayOption = parser->GetOption( "display-mesh" );
if( displayOption && displayOption->GetNumberOfValues() > 0 )
{
if( displayOption->GetNumberOfParameters() > 0 )
Expand Down Expand Up @@ -299,7 +298,7 @@ int ANTSConformalMapping( itk::CommandLineParser *parser )
/**
* Initialization
*/
typename itk::CommandLineParser::OptionType::Pointer inOption =
typename itk::ants::CommandLineParser::OptionType::Pointer inOption =
parser->GetOption( "input-mesh" );
if( inOption && inOption->GetNumberOfParameters() == 2 )
{
Expand Down Expand Up @@ -394,7 +393,7 @@ int ANTSConformalMapping( itk::CommandLineParser *parser )
/**
* output
*/
typename itk::CommandLineParser::OptionType::Pointer outputOption =
typename itk::ants::CommandLineParser::OptionType::Pointer outputOption =
parser->GetOption( "output" );
if( outputOption && outputOption->GetNumberOfValues() > 0 )
{
Expand Down Expand Up @@ -455,7 +454,7 @@ int main( int argc, char *argv[] )
exit( 1 );
}

itk::CommandLineParser::Pointer parser = itk::CommandLineParser::New();
itk::ants::CommandLineParser::Pointer parser = itk::ants::CommandLineParser::New();
parser->SetCommand( argv[0] );

std::string commandDescription =
Expand Down
70 changes: 36 additions & 34 deletions Examples/Atropos.cxx
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
#include "itkAtroposSegmentationImageFilter.h"
#include "itkBoxPlotQuantileListSampleFilter.h"
#include "itkCommandLineOption.h"
#include "itkCommandLineParser.h"
#include "itkGaussianListSampleFunction.h"
#include "itkGrubbsRosnerListSampleFilter.h"
#include "itkHistogramParzenWindowsListSampleFunction.h"
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkImageRegionIterator.h"
#include "itkListSampleToListSampleFilter.h"
#include "itkManifoldParzenWindowsListSampleFunction.h"
#include "itkMaskImageFilter.h"
#include "itkNumericSeriesFileNames.h"
#include "itkPassThroughListSampleFilter.h"
#include "itkVectorImage.h"
#include "itkVectorIndexSelectionCastImageFilter.h"

#include "antsAtroposSegmentationImageFilter.h"
#include "antsBoxPlotQuantileListSampleFilter.h"
#include "antsCommandLineOption.h"
#include "antsCommandLineParser.h"
#include "antsGaussianListSampleFunction.h"
#include "antsGrubbsRosnerListSampleFilter.h"
#include "antsHistogramParzenWindowsListSampleFunction.h"
#include "antsListSampleToListSampleFilter.h"
#include "antsManifoldParzenWindowsListSampleFunction.h"
#include "antsPassThroughListSampleFilter.h"

#include <string>
#include <algorithm>
#include <vector>
Expand Down Expand Up @@ -67,7 +68,7 @@ void ConvertToLowerCase( std::string& str )
}

template <unsigned int ImageDimension>
int AtroposSegmentation( itk::CommandLineParser *parser )
int AtroposSegmentation( itk::ants::CommandLineParser *parser )
{
typedef float PixelType;
typedef float RealType;
Expand All @@ -76,7 +77,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
typedef unsigned char LabelType;
typedef itk::Image<LabelType, ImageDimension> LabelImageType;

typedef itk::AtroposSegmentationImageFilter
typedef itk::ants::AtroposSegmentationImageFilter
<InputImageType, LabelImageType> SegmentationFilterType;
typename SegmentationFilterType::Pointer segmenter
= SegmentationFilterType::New();
Expand All @@ -89,7 +90,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
/**
* Initialization
*/
typename itk::CommandLineParser::OptionType::Pointer initializationOption =
typename itk::ants::CommandLineParser::OptionType::Pointer initializationOption =
parser->GetOption( "initialization" );
if( initializationOption
&& initializationOption->GetNumberOfParameters() < 1 )
Expand Down Expand Up @@ -214,7 +215,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
/**
* convergence options
*/
typename itk::CommandLineParser::OptionType::Pointer convergenceOption =
typename itk::ants::CommandLineParser::OptionType::Pointer convergenceOption =
parser->GetOption( "convergence" );
if( convergenceOption )
{
Expand All @@ -233,7 +234,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
/**
* Mask image
*/
typename itk::CommandLineParser::OptionType::Pointer maskOption =
typename itk::ants::CommandLineParser::OptionType::Pointer maskOption =
parser->GetOption( "mask-image" );
if( maskOption && maskOption->GetNumberOfValues() > 0 )
{
Expand All @@ -255,7 +256,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
* BSpline options
*/

typename itk::CommandLineParser::OptionType::Pointer bsplineOption =
typename itk::ants::CommandLineParser::OptionType::Pointer bsplineOption =
parser->GetOption( "bspline" );
if( bsplineOption && bsplineOption->GetNumberOfValues() )
{
Expand Down Expand Up @@ -316,7 +317,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
/**
* labels
*/
typename itk::CommandLineParser::OptionType::Pointer labelOption =
typename itk::ants::CommandLineParser::OptionType::Pointer labelOption =
parser->GetOption( "labels" );
if( labelOption && labelOption->GetNumberOfValues() > 0 )
{
Expand Down Expand Up @@ -355,7 +356,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
/**
* intensity images
*/
typename itk::CommandLineParser::OptionType::Pointer imageOption =
typename itk::ants::CommandLineParser::OptionType::Pointer imageOption =
parser->GetOption( "intensity-image" );
if( imageOption && imageOption->GetNumberOfValues() > 0 )
{
Expand Down Expand Up @@ -410,7 +411,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
/**
* MRF options
*/
typename itk::CommandLineParser::OptionType::Pointer mrfOption =
typename itk::ants::CommandLineParser::OptionType::Pointer mrfOption =
parser->GetOption( "mrf" );
if( mrfOption && mrfOption->GetNumberOfValues() > 0 )
{
Expand Down Expand Up @@ -448,7 +449,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
/**
* euclidean distance
*/
typename itk::CommandLineParser::OptionType::Pointer distanceOption =
typename itk::ants::CommandLineParser::OptionType::Pointer distanceOption =
parser->GetOption( "use-euclidean-distance" );
if( distanceOption && distanceOption->GetNumberOfValues() > 0 )
{
Expand All @@ -459,7 +460,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
/**
* memory-usage
*/
typename itk::CommandLineParser::OptionType::Pointer memoryOption =
typename itk::ants::CommandLineParser::OptionType::Pointer memoryOption =
parser->GetOption( "minimize-memory-usage" );
if( memoryOption && memoryOption->GetNumberOfValues() > 0 )
{
Expand All @@ -470,7 +471,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
/**
* likelihood
*/
typename itk::CommandLineParser::OptionType::Pointer likelihoodOption =
typename itk::ants::CommandLineParser::OptionType::Pointer likelihoodOption =
parser->GetOption( "likelihood-model" );
if( likelihoodOption && likelihoodOption->GetNumberOfValues() > 0 )
{
Expand All @@ -479,7 +480,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
if( !likelihoodModel.compare( std::string( "gaussian" ) ) )
{
typedef typename SegmentationFilterType::SampleType SampleType;
typedef itk::Statistics::GaussianListSampleFunction
typedef itk::ants::Statistics::GaussianListSampleFunction
<SampleType, float, float> LikelihoodType;
for( unsigned int n = 0; n < segmenter->GetNumberOfClasses(); n++ )
{
Expand All @@ -491,7 +492,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
else if( !likelihoodModel.compare( std::string( "manifoldparzenwindows" ) ) )
{
typedef typename SegmentationFilterType::SampleType SampleType;
typedef itk::Statistics::ManifoldParzenWindowsListSampleFunction
typedef itk::ants::Statistics::ManifoldParzenWindowsListSampleFunction
<SampleType, float, float> LikelihoodType;

float regularizationSigma = 1.0;
Expand Down Expand Up @@ -532,7 +533,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
else if( !likelihoodModel.compare( std::string( "histogramparzenwindows" ) ) )
{
typedef typename SegmentationFilterType::SampleType SampleType;
typedef itk::Statistics::HistogramParzenWindowsListSampleFunction
typedef itk::ants::Statistics::HistogramParzenWindowsListSampleFunction
<SampleType, float, float> LikelihoodType;

float sigma = 1.0;
Expand Down Expand Up @@ -566,7 +567,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
/**
* outliers?
*/
typename itk::CommandLineParser::OptionType::Pointer outlierOption =
typename itk::ants::CommandLineParser::OptionType::Pointer outlierOption =
parser->GetOption( "winsorize-outliers" );
if( outlierOption && outlierOption->GetNumberOfValues() > 0 )
{
Expand All @@ -575,7 +576,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
if( !outlierStrategy.compare( std::string( "boxplot" ) ) )
{
typedef typename SegmentationFilterType::SampleType SampleType;
typedef itk::Statistics::BoxPlotQuantileListSampleFilter<SampleType>
typedef itk::ants::Statistics::BoxPlotQuantileListSampleFilter<SampleType>
SampleFilterType;
typename SampleFilterType::Pointer boxplotFilter =
SampleFilterType::New();
Expand All @@ -600,7 +601,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
else if( !outlierStrategy.compare( std::string( "grubbsrosner" ) ) )
{
typedef typename SegmentationFilterType::SampleType SampleType;
typedef itk::Statistics::GrubbsRosnerListSampleFilter<SampleType>
typedef itk::ants::Statistics::GrubbsRosnerListSampleFilter<SampleType>
SampleFilterType;
typename SampleFilterType::Pointer grubbsFilter =
SampleFilterType::New();
Expand Down Expand Up @@ -637,7 +638,7 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
/**
* output
*/
typename itk::CommandLineParser::OptionType::Pointer outputOption =
typename itk::ants::CommandLineParser::OptionType::Pointer outputOption =
parser->GetOption( "output" );
if( outputOption && outputOption->GetNumberOfValues() > 0 )
{
Expand Down Expand Up @@ -762,9 +763,9 @@ int AtroposSegmentation( itk::CommandLineParser *parser )
return EXIT_SUCCESS;
}

void InitializeCommandLineOptions( itk::CommandLineParser *parser )
void InitializeCommandLineOptions( itk::ants::CommandLineParser *parser )
{
typedef itk::CommandLineParser::OptionType OptionType;
typedef itk::ants::CommandLineParser::OptionType OptionType;

{
std::string description =
Expand Down Expand Up @@ -863,7 +864,7 @@ void InitializeCommandLineOptions( itk::CommandLineParser *parser )
+ std::string( "less than the specified threshold from the previous " )
+ std::string( "iteration the program terminates.");

// std::string( "\t Usage: \n" ) +
// std::string( "\t Usage: \n" ) +
// std::string( "\t [<numberOfIterations=5>,<convergenceThreshold=0.001>]" );

OptionType::Pointer option = OptionType::New();
Expand Down Expand Up @@ -1040,11 +1041,12 @@ int main( int argc, char *argv[] )
if( argc < 2 )
{
std::cout << "Usage: " << argv[0]
<< " imageDimension args" << std::endl;
<< " -h or --help " << std::endl;
exit( 1 );
}

itk::CommandLineParser::Pointer parser = itk::CommandLineParser::New();
itk::ants::CommandLineParser::Pointer parser =
itk::ants::CommandLineParser::New();
parser->SetCommand( argv[0] );

std::string commandDescription =
Expand Down
2 changes: 1 addition & 1 deletion Examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ INCLUDE_DIRECTORIES(${PICSL_INCLUDE_DIRS})
LINK_DIRECTORIES( ${ITK_LIBRARY_PATH} )

# non-templated class -- this should be stored in a library and linked in...
SET(UI_SOURCES "../Utilities/itkCommandLineParser" "../Utilities/itkCommandLineOption" )
SET(UI_SOURCES "../Utilities/antsCommandLineParser" "../Utilities/antsCommandLineOption" )

ADD_EXECUTABLE(ANTS ANTS.cxx ${UI_SOURCES})
TARGET_LINK_LIBRARIES(ANTS ITKCommon ITKBasicFilters ITKIO ITKNumerics ITKStatistics ITKFEM )
Expand Down
4 changes: 2 additions & 2 deletions ImageRegistration/itkANTSImageRegistrationOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkVectorGaussianInterpolateImageFunction.h"
#include "itkCommandLineParser.h"
#include "antsCommandLineParser.h"
#include "itkShiftScaleImageFilter.h"
#include "itkMinimumMaximumImageFilter.h"
#include "itkImage.h"
Expand Down Expand Up @@ -105,7 +105,7 @@ class ITK_EXPORT ANTSImageRegistrationOptimizer
float> VelocityFieldInterpolatorType2;
typedef typename DeformationFieldType::IndexType IndexType;

typedef CommandLineParser ParserType;
typedef ants::CommandLineParser ParserType;
typedef typename ParserType::OptionType OptionType;

typedef GeneralToBSplineDeformationFieldFilter<DeformationFieldType> BSplineFilterType;
Expand Down
7 changes: 3 additions & 4 deletions ImageRegistration/itkANTSImageTransformation.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "itkObject.h"
#include "itkObjectFactory.h"

#include "itkCommandLineParser.h"
#include "antsCommandLineParser.h"
#include "itkImage.h"
#include "itkMacro.h"

Expand All @@ -33,7 +33,6 @@
#include "itkCenteredTransformInitializer.h"
#include "itkTransformFileReader.h"
#include "itkTransformFileWriter.h"

namespace itk
{
template <unsigned int TDimension = 3, class TReal = float>
Expand Down Expand Up @@ -70,8 +69,8 @@ class ITK_EXPORT ANTSImageTransformation
typedef typename DeformationFieldType::SizeType DeformationRegionOfInterestSizeType;
typedef typename DeformationFieldType::PointType DeformationRegionOfInterestCenterType;

typedef CommandLineParser ParserType;
typedef typename ParserType::OptionType OptionType;
typedef typename ants::CommandLineParser ParserType;
typedef typename ParserType::OptionType OptionType;

/** Set functions */
void SetDeformationRegionOfInterest( DeformationRegionOfInterestCenterType DRC,
Expand Down
4 changes: 2 additions & 2 deletions ImageRegistration/itkPICSLAdvancedNormalizationToolKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "itkANTSImageTransformation.h"
#include "itkANTSImageRegistrationOptimizer.h"
#include "itkANTSSimilarityMetric.h"
#include "itkCommandLineParser.h"
#include "antsCommandLineParser.h"
#include "itkImage.h"
#include "itkMacro.h"
#include "itkANTSLabeledPointSet.h"
Expand Down Expand Up @@ -74,7 +74,7 @@ class ITK_EXPORT PICSLAdvancedNormalizationToolKit
typedef std::vector<SimilarityMetricPointer> SimilarityMetricListType;
typedef typename SimilarityMetricType::MetricType MetricBaseType;

typedef CommandLineParser ParserType;
typedef ants::CommandLineParser ParserType;
typedef typename ParserType::OptionType OptionType;

void ParseCommandLine( int argc, char * *argv );
Expand Down
Loading

0 comments on commit 207d7e4

Please sign in to comment.