TARGET_LINK_LIBRARIES(clitkAffineTransform clitkCommon )
SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkAffineTransform)
+ WRAP_GGO(clitkElastixTransformToMatrix_GGO_C clitkElastixTransformToMatrix.ggo)
+ ADD_EXECUTABLE(clitkElastixTransformToMatrix clitkElastixTransformToMatrix.cxx ${clitkElastixTransformToMatrix_GGO_C})
+ TARGET_LINK_LIBRARIES(clitkElastixTransformToMatrix clitkCommon )
+ SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkElastixTransformToMatrix)
+
+
WRAP_GGO(clitkSetBackground_GGO_C clitkSetBackground.ggo)
ADD_EXECUTABLE(clitkSetBackground clitkSetBackground.cxx clitkSetBackgroundGenericFilter.cxx ${clitkSetBackground_GGO_C})
TARGET_LINK_LIBRARIES(clitkSetBackground clitkCommon)
//----------------------------------------
void Update();
+ template<unsigned int Dimension, class PixelType>
+ static
+ typename itk::Matrix<double, Dimension+1, Dimension+1>
+ createMatrixFromElastixFile(std::vector<std::string> & filename, bool verbose=true);
+
protected:
//----------------------------------------
template <unsigned int Dimension, class PixelType> void UpdateWithDimAndPixelType();
template <unsigned int Dimension, class PixelType> void UpdateWithDimAndVectorType();
- template<unsigned int Dimension, class PixelType>
- typename itk::Matrix<double, Dimension+1, Dimension+1>
- createMatrixFromElastixFile(std::vector<std::string> & filename);
-
- bool GetElastixValueFromTag(std::ifstream & is, std::string tag, std::string & value);
- void GetValuesFromValue(const std::string & s,
- std::vector<std::string> & values);
+ static bool GetElastixValueFromTag(std::ifstream & is, std::string tag, std::string & value);
+ static void GetValuesFromValue(const std::string & s,
+ std::vector<std::string> & values);
//----------------------------------------
// Data members
if (m_ArgsInfo.elastix_given) {
std::vector<std::string> s;
for(uint i=0; i<m_ArgsInfo.elastix_given; i++) s.push_back(m_ArgsInfo.elastix_arg[i]);
- matrix = createMatrixFromElastixFile<Dimension,PixelType>(s);
+ matrix = createMatrixFromElastixFile<Dimension,PixelType>(s, m_Verbose);
}
else
matrix.SetIdentity();
template<class args_info_type>
template<unsigned int Dimension, class PixelType>
typename itk::Matrix<double, Dimension+1, Dimension+1>
- AffineTransformGenericFilter<args_info_type>::createMatrixFromElastixFile(std::vector<std::string> & filename)
+ AffineTransformGenericFilter<args_info_type>::createMatrixFromElastixFile(std::vector<std::string> & filename, bool verbose)
{
if (Dimension != 3) {
FATAL("Only 3D yet" << std::endl);
for(uint j=0; j<filename.size(); j++) {
// Open file
- if (m_Verbose) std::cout << "Read elastix parameters in " << filename[j] << std::endl;
+ if (verbose) std::cout << "Read elastix parameters in " << filename[j] << std::endl;
std::ifstream is;
clitk::openFileForReading(is, filename[j]);
p[i+6] = atof(results[i+3].c_str()); // Translation
mat->SetParameters(p);
- if (m_Verbose) {
+ if (verbose) {
std::cout << "Rotation (deg) : " << rad2deg(p[0]) << " " << rad2deg(p[1]) << " " << rad2deg(p[2]) << std::endl;
std::cout << "Center of rot (phy) : " << p[3] << " " << p[4] << " " << p[5] << std::endl;
std::cout << "Translation (phy) : " << p[6] << " " << p[7] << " " << p[8] << std::endl;
// Compose with previous if needed
if (j!=0) {
mat->Compose(previous);
- if (m_Verbose) {
+ if (verbose) {
std::cout << "Composed rotation (deg) : " << rad2deg(mat->GetAngleX()) << " " << rad2deg(mat->GetAngleY()) << " " << rad2deg(mat->GetAngleZ()) << std::endl;
std::cout << "Composed center of rot (phy) : " << mat->GetCenter() << std::endl;
std::cout << "Compsoed translation (phy) : " << mat->GetTranslation() << std::endl;