[Insight-users] Points after VersorRigid3DTransform
agatte
wiatrak11 at poczta.onet.pl
Tue Apr 24 01:32:56 EDT 2012
Hi ;)
I am trying to make rigid registration using VersorRigid3DTransform.
I have landmarks from CT and landmarks from tracker.
I have aleady received a result of transform.
I need to have a points after registration.
I don't have any idea for it.
Could anyone help me please ?
I would appreciate for any help ;)
My code :
int main()
{
double*pReturn; // poitns atfter transformation
// double tab[30]; // data for testing
double tab[30] =
{138.6933, 231.3487,-32.96535,
141.1425,236.4764,-77.96535,
144.5423,239.5312,-119.2154,
43.92002,222.6613,-69.21533,
230.9095,214.9283,-69.21535,
-172.41,-262.59,822.04,
-174.23,-264.49,861.7,
-161.54,-265.46,928.22,
-186.33,-160.82,885.01,
-186.79,-366.81,863.97 };
typedef float VectorComponentType;
typedef itk::Vector< VectorComponentType, Dimension > VectorType;
typedef itk::Image< VectorType, Dimension > DeformationFieldType;
typedef itk::VersorRigid3DTransform< double > Rigid3DTransformType;
typedef itk::LandmarkBasedTransformInitializer<
Rigid3DTransformType,ImageType, ImageType>
LandmarkBasedTransformInitializerType;
LandmarkBasedTransformInitializerType::Pointer
landmarkBasedTransformInitializer =
LandmarkBasedTransformInitializerType::New();
// Create source and target landmarks.
typedef LandmarkBasedTransformInitializerType::LandmarkPointContainer
LandmarkContainerType;
typedef LandmarkBasedTransformInitializerType::LandmarkPointType
LandmarkPointType;
LandmarkContainerType imageLandmarks;
LandmarkContainerType trackerLandmarks;
LandmarkPointType imagePoint; // CT data
LandmarkPointType trackerPoint; //data from tracking system
// 1 landmark
trackerPoint[0] = tab[0];
trackerPoint[1] = tab[1];
trackerPoint[2] = tab[2];
imagePoint[0] = tab[3];
imagePoint[1] = tab[4];
imagePoint[2] = tab[5];
imageLandmarks.push_back(imagePoint );
trackerLandmarks.push_back(trackerPoint );
// 2 landmark
trackerPoint[0] = tab[6];
trackerPoint[1] = tab[7];
trackerPoint[2] = tab[8];
imagePoint[0] = tab[9];
imagePoint[1] = tab[10];
imagePoint[2] = tab[11];
imageLandmarks.push_back(imagePoint );
trackerLandmarks.push_back(trackerPoint );
// 3 landmark
trackerPoint[0] = tab[12];
trackerPoint[1] = tab[13];
trackerPoint[2] = tab[14];
imagePoint[0] = tab[15];
imagePoint[1] = tab[16];
imagePoint[2] = tab[17];
imageLandmarks.push_back(imagePoint );
trackerLandmarks.push_back(trackerPoint );
// 4 landmark
trackerPoint[0] = tab[18];
trackerPoint[1] = tab[19];
trackerPoint[2] = tab[20];
imagePoint[0] = tab[21];
imagePoint[1] = tab[22];
imagePoint[2] = tab[23];
imageLandmarks.push_back(imagePoint );
trackerLandmarks.push_back(trackerPoint );
// 5 landmark
trackerPoint[0] = tab[24];
trackerPoint[1] = tab[25];
trackerPoint[2] = tab[26];
imagePoint[0] = tab[27];
imagePoint[1] = tab[28];
imagePoint[2] = tab[29];
imageLandmarks.push_back(imagePoint );
trackerLandmarks.push_back(trackerPoint );
landmarkBasedTransformInitializer->SetFixedLandmarks( imageLandmarks);
landmarkBasedTransformInitializer->SetMovingLandmarks( trackerLandmarks);
Rigid3DTransformType::Pointer transform = Rigid3DTransformType::New();
transform->SetIdentity();
landmarkBasedTransformInitializer->SetTransform(transform);
landmarkBasedTransformInitializer->InitializeTransform();
cout<<"transform : "<<transform<<endl;
// transform->GetParameters();
// pReturn[0]= ...
cout<<"Parametrs : \n "<<transform->GetParameters()<<endl;
//Rigid3DTransformType::MatrixType matrix =
transform->GetRotationMatrix();
//Rigid3DTransformType::OffsetType offset = transform->GetOffset();
//cout<<"matrix: "<<matrix<<endl;
//cout<<"offset: "<<offset<<endl;
return EXIT_SUCCESS;
}
--
View this message in context: http://old.nabble.com/Points-after-VersorRigid3DTransform-tp33737562p33737562.html
Sent from the ITK - Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list