1 #include <tclap/CmdLine.h> 7 int main(
int ac,
const char** av)
9 TCLAP::CmdLine cmd(
"INRIA / IRISA - VisAGeS/Empenn Team",
' ', ANIMA_VERSION);
11 TCLAP::ValueArg<std::string> inArg(
"i",
"input",
"Input field",
true,
"",
"input image",cmd);
12 TCLAP::ValueArg<std::string> outArg(
"o",
"output",
"Output jacobian image",
true,
"",
"output image",cmd);
14 TCLAP::ValueArg<unsigned int> neighArg(
"n",
"neigh",
"Neighborhood size for Jacobian computation (default: 0 = 6-connectivity)",
false,0,
"neighborhood size",cmd);
16 TCLAP::SwitchArg svfArg(
"S",
"svf",
"Compute the exponential of the input SVF",cmd,
false);
17 TCLAP::ValueArg<unsigned int> expOrderArg(
"e",
"exp-order",
"Order of field exponentiation approximation (in between 0 and 1, default: 0)",
false,0,
"exponentiation order",cmd);
18 TCLAP::SwitchArg noIdArg(
"N",
"no-id",
"Do not add identity to the jacobian matrix",cmd,
false);
19 TCLAP::SwitchArg detArg(
"D",
"det",
"Simply compute the determinant of the jacobian (-N option ignored in that case)",cmd,
false);
20 TCLAP::ValueArg<unsigned int> nbpArg(
"p",
"numberofthreads",
"Number of threads to run on (default: all cores)",
false,itk::MultiThreaderBase::GetGlobalDefaultNumberOfThreads(),
"number of threads",cmd);
26 catch (TCLAP::ArgException& e)
28 std::cerr <<
"Error: " << e.error() <<
"for argument " << e.argId() << std::endl;
32 const unsigned int Dimension = 3;
33 typedef double PixelType;
35 typedef itk::Image <itk::Vector <PixelType, Dimension>, Dimension> ImageType;
37 ImageType::Pointer inputField = anima::readImage <ImageType> (inArg.getValue());
41 typedef itk::StationaryVelocityFieldTransform <PixelType, Dimension> SVFType;
42 SVFType::Pointer svfTrsf = SVFType::New();
43 svfTrsf->SetParametersAsVectorField(inputField);
45 typedef rpi::DisplacementFieldTransform <PixelType, Dimension> RPIDispType;
46 RPIDispType::Pointer resTrsf = RPIDispType::New();
50 inputField = const_cast <ImageType *> (resTrsf->GetParametersAsVectorField());
54 MainFilterType::Pointer mainFilter = MainFilterType::New();
56 mainFilter->SetInput(inputField);
57 mainFilter->SetNumberOfWorkUnits(nbpArg.getValue());
58 mainFilter->SetNeighborhood(neighArg.getValue());
59 mainFilter->SetNoIdentity(noIdArg.isSet());
60 mainFilter->SetComputeDeterminant(detArg.isSet());
65 anima::writeImage <MainFilterType::DeterminantImageType> (outArg.getValue(),mainFilter->GetDeterminantImage());
67 anima::writeImage <MainFilterType::OutputImageType> (outArg.getValue(),mainFilter->GetOutput());
Compute the Jacobian matrix in real coordinates of a displacement field.
void GetSVFExponential(itk::StationaryVelocityFieldTransform< ScalarType, NDimensions > *baseTrsf, rpi::DisplacementFieldTransform< ScalarType, NDimensions > *resultTransform, unsigned int exponentiationOrder, unsigned int numThreads, bool invert)
int main(int ac, const char **av)