42 int main(
int argc,
char * argv[])
46 std::cerr <<
"Usage: " << argv[0] <<
" inputImageFile ";
47 std::cerr <<
" p q" << std::endl;
51 const char * inputFilename = argv[1];
53 unsigned int P((
unsigned char) ::atoi(argv[2]));
54 unsigned int Q((
unsigned char) ::atoi(argv[3]));
56 typedef unsigned char InputPixelType;
57 const unsigned int Dimension = 2;
62 ReaderType::Pointer reader = ReaderType::New();
64 reader->SetFileName(inputFilename);
76 typedef CMType::OutputType OutputType;
78 CMType::Pointer cmFunction = CMType::New();
90 cmFunction->SetInputImage(reader->GetOutput());
91 cmFunction->SetQmax(Q);
92 cmFunction->SetPmax(P);
102 InputImageType::IndexType center;
113 cmFunction->SetNeighborhoodRadius(15);
122 OutputType Result = cmFunction->EvaluateAtIndex(center);
124 std::cout <<
"The moment of order (" << P <<
"," << Q <<
125 ") is equal to " << Result.at(P).at(Q) << std::endl;