Commit c8829d8d authored by Ivy Uszynski's avatar Ivy Uszynski
Browse files

new command for calculating normalized root mean sqaure difference between two images

parent be15c180
......@@ -68,10 +68,11 @@ MotionCorrection/MotionCorrectionCommand.h
Nifti2GisConverter/Nifti2GisConverterCommand.h
NonLocalMeansFilter/NonLocalMeansFilterCommand.h
Normalization3d/Normalization3dCommand.h
NormalizedRootMeanSquareDifference/NormalizedRootMeanSquareDifferenceCommand.h
OrientationSetEvaluator/OrientationSetEvaluatorCommand.h
PhaseUnwrapper/PhaseUnwrapperCommand.h
PhilipsPhaseMapConverter/PhilipsPhaseMapConverterCommand.h
PostMortemBlockToWholeImageComposer/PostMortemBlockToWholeImageComposerCommand.h
#PostMortemBlockToWholeImageComposer/PostMortemBlockToWholeImageComposerCommand.h
PottsRegularizer/PottsRegularizerCommand.h
RandomIndexGenerator/RandomIndexGeneratorCommand.h
Registration3d/Registration3dCommand.h
......@@ -189,10 +190,11 @@ MotionCorrection/MotionCorrectionCommand.cxx
Nifti2GisConverter/Nifti2GisConverterCommand.cxx
NonLocalMeansFilter/NonLocalMeansFilterCommand.cxx
Normalization3d/Normalization3dCommand.cxx
NormalizedRootMeanSquareDifference/NormalizedRootMeanSquareDifferenceCommand.cxx
OrientationSetEvaluator/OrientationSetEvaluatorCommand.cxx
PhaseUnwrapper/PhaseUnwrapperCommand.cxx
PhilipsPhaseMapConverter/PhilipsPhaseMapConverterCommand.cxx
PostMortemBlockToWholeImageComposer/PostMortemBlockToWholeImageComposerCommand.cxx
#PostMortemBlockToWholeImageComposer/PostMortemBlockToWholeImageComposerCommand.cxx
PottsRegularizer/PottsRegularizerCommand.cxx
RandomIndexGenerator/RandomIndexGeneratorCommand.cxx
Registration3d/Registration3dCommand.cxx
......
#include <gkg-processing-plugin-functors/NormalizedRootMeanSquareDifference/NormalizedRootMeanSquareDifferenceCommand.h>
#include <gkg-communication-command/CommandFactory.h>
#include <gkg-communication-getopt/Application.h>
#include <gkg-processing-container/Volume_i.h>
#include <gkg-core-io/Reader_i.h>
#include <gkg-core-io/Writer_i.h>
#include <gkg-core-exception/Exception.h>
#include <iostream>
////////////////////////////////////////////////////////////////////////////////
// class NormalizedRootMeanSquareDifferenceCommand
////////////////////////////////////////////////////////////////////////////////
gkg::NormalizedRootMeanSquareDifferenceCommand::NormalizedRootMeanSquareDifferenceCommand(
int32_t argc,
char* argv[],
bool loadPlugin,
bool removeFirst )
: gkg::Command( argc, argv,
loadPlugin,
removeFirst )
{
try
{
parse();
}
GKG_CATCH( "gkg::NormalizedRootMeanSquareDifferenceCommand::"
"NormalizedRootMeanSquareDifferenceCommand( int32_t argc, "
"char* argv[], bool loadPlugin, bool removeFirst ) "
" : gkg::Command( argc, argv, loadPlugin, removeFirst )" );
}
gkg::NormalizedRootMeanSquareDifferenceCommand::NormalizedRootMeanSquareDifferenceCommand(
const std::vector< std::string >& fileNameIns,
const std::string& fileNameOut,
const std::string& fileNameMask,
bool verbose )
{
try
{
execute( fileNameIns, fileNameOut, fileNameMask, verbose );
}
GKG_CATCH( "gkg::NormalizedRootMeanSquareDifferenceCommand::"
"NormalizedRootMeanSquareDifferenceCommand( "
"const std::vector< std::string >& fileNameIns, "
"const std::string& fileNameOut, "
"const std::string& fileNameMask, "
"bool verbose )" );
}
gkg::NormalizedRootMeanSquareDifferenceCommand::NormalizedRootMeanSquareDifferenceCommand(
const gkg::Dictionary& parameters )
: gkg::Command( parameters )
{
try
{
DECLARE_VECTOR_OF_STRINGS_PARAMETER( parameters, std::vector< std::string >,
fileNameIns );
DECLARE_STRING_PARAMETER( parameters, std::string, fileNameOut );
DECLARE_STRING_PARAMETER( parameters, std::string, fileNameMask );
DECLARE_BOOLEAN_PARAMETER( parameters, bool, verbose );
execute( fileNameIns, fileNameOut, fileNameMask, verbose );
}
GKG_CATCH( "gkg::NormalizedRootMeanSquareDifferenceCommand::"
"NormalizedRootMeanSquareDifferenceCommand( const "
"gkg::Dictionary& parameters ) : gkg::Command( parameters )" );
}
gkg::NormalizedRootMeanSquareDifferenceCommand::
~NormalizedRootMeanSquareDifferenceCommand()
{
}
std::string gkg::NormalizedRootMeanSquareDifferenceCommand::getStaticName()
{
try
{
return "NormalizedRootMeanSquareDifference";
}
GKG_CATCH( "std::string gkg::"
"NormalizedRootMeanSquareDifferenceCommand::getStaticName()" );
}
void gkg::NormalizedRootMeanSquareDifferenceCommand::parse()
{
try
{
std::vector< std::string > fileNameIns;
std::string fileNameOut;
std::string fileNameMask;
bool verbose = false;
gkg::Application application( _argc, _argv,
"Normalized Root Mean Square Difference",
_loadPlugin );
application.addSeriesOption( "-i",
"Input volume file name list",
fileNameIns,
2 );
application.addSingleOption( "-o",
"Output text file name (.txt)",
fileNameOut );
application.addSingleOption( "-m",
"Mask volume file name",
fileNameMask );
application.addSingleOption( "-verbose",
"Show as much information as possible",
verbose,
true );
application.initialize();
execute( fileNameIns, fileNameOut, fileNameMask, verbose );
}
GKG_CATCH_FUNCTOR( "void gkg::"
"NormalizedRootMeanSquareDifferenceCommand::parse()" );
}
void gkg::NormalizedRootMeanSquareDifferenceCommand::execute(
const std::vector< std::string >& fileNameIns,
const std::string& fileNameOut,
const std::string& fileNameMask,
bool verbose )
{
try
{
std::cout << "Performing normalized RMS difference" << std::endl;
}
GKG_CATCH( "void gkg::NormalizedRootMeanSquareDifferenceCommand::execute( "
"const std::vector< std::string >& fileNameIns, "
"const std::string& fileNameOut, "
"const std::string& fileNameMask, "
"bool verbose )" );
}
RegisterCommandCreator(
NormalizedRootMeanSquareDifferenceCommand,
DECLARE_VECTOR_OF_STRINGS_PARAMETER_HELP( fileNameIns ) +
DECLARE_STRING_PARAMETER_HELP( fileNameOut ) +
DECLARE_STRING_PARAMETER_HELP( fileNameMask ) +
DECLARE_BOOLEAN_PARAMETER_HELP( verbose ) );
#ifndef _gkg_processing_plugin_functors_NormalizedRootMeanSquareDifference_NormalizedRootMeanSquareDifferenceCommand_h_
#define _gkg_processing_plugin_functors_NormalizedRootMeanSquareDifference_NormalizedRootMeanSquareDifferenceCommand_h_
#include <gkg-communication-command/Command.h>
#include <gkg-core-pattern/Creator.h>
#include <gkg-processing-numericalanalysis/Vector.h>
#include <gkg-processing-container/Volume.h>
#include <gkg-core-pattern/RCPointer.h>
#include <string>
#include <vector>
namespace gkg
{
class NormalizedRootMeanSquareDifferenceCommand : public Command,
public Creator2Arg< NormalizedRootMeanSquareDifferenceCommand,
Command,
int32_t,
char** >,
public Creator1Arg< NormalizedRootMeanSquareDifferenceCommand,
Command,
const Dictionary& >
{
public:
NormalizedRootMeanSquareDifferenceCommand( int32_t argc,
char* argv[],
bool loadPlugin = false,
bool removeFirst = true );
NormalizedRootMeanSquareDifferenceCommand(
const std::vector< std::string >& fileNameIns,
const std::string& fileNameOut,
const std::string& fileNameMask,
bool verbose );
NormalizedRootMeanSquareDifferenceCommand( const Dictionary& parameters );
virtual ~NormalizedRootMeanSquareDifferenceCommand();
static std::string getStaticName();
protected:
friend class Creator2Arg< NormalizedRootMeanSquareDifferenceCommand,
Command, int32_t, char** >;
friend class Creator1Arg< NormalizedRootMeanSquareDifferenceCommand,
Command, const Dictionary& >;
void parse();
void execute( const std::vector< std::string >& fileNameIns,
const std::string& fileNameOut,
const std::string& fileNameMask,
bool verbose );
};
}
#endif
\ No newline at end of file
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