1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
/*=========================================================================
Program: Image Guided Surgery Software Toolkit
Module: $RCSfile: TransformWriterExample.cxx,v $
Language: C++
Date: $Date: 2010-12-14 16:31:33 $
Version: $Revision: 1.2 $
Copyright (c) ISC Insight Software Consortium. All rights reserved.
See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "igstkPrecomputedTransformData.h"
#include "igstkTransformFileWriter.h"
#include "igstkRigidTransformXMLFileWriter.h"
#include "itksys/SystemTools.hxx"
/**
* This program writes an xml file with the given transformation data.
*
*/
int main(int , char *[])
{
std::string OUTPUT_FILE_NAME("example.xml");
igstk::PrecomputedTransformData::Pointer transformationData =
igstk::PrecomputedTransformData::New();
//rigid transformation
igstk::Transform::VersorType r;
igstk::Transform::VectorType t;
r.Set(0.7606, 0.1850, 0.4858, 0.3890);
t[0] = 2; t[1] = 3; t[2] = 5;
double estimationError = 0.2;
igstk::Transform registrationResult;
registrationResult.SetTranslationAndRotation( t, r, estimationError,
igstk::TimeStamp::GetLongestPossibleTime() );
std::string description;
description = "MR/CT registration";
std::string estimationDate =
itksys::SystemTools::GetCurrentDateTime( "%Y %b %d %H:%M:%S" );
transformationData->RequestInitialize( ®istrationResult, estimationDate,
description, estimationError );
igstk::TransformFileWriter::Pointer transformFileWriter =
igstk::TransformFileWriter::New();
igstk::TransformXMLFileWriterBase::Pointer xmlFileWriter;
xmlFileWriter = igstk::RigidTransformXMLFileWriter::New();
transformFileWriter->RequestSetWriter( xmlFileWriter );
transformFileWriter->RequestSetData( transformationData,
OUTPUT_FILE_NAME );
transformFileWriter->RequestWrite();
}
|