[Insight-users] setting fixedpointset
tony hakki
tony2007vtk at yahoo.com
Sat Mar 17 06:54:43 EST 2007
hello;
I tried to implement pointsetToImageRegistration. in existing example fixed pointset is created by user. But I have also a mesh. I would like to use that mesh as a fixed point set. To do that I have to modify the following part of the existing example. I have tried a several ways but I couldn't achieve . what should i use instead of fixedImage .Well, I use the variable of mesh (which I try to use as fixedpointset) instead of fixedPointSet. But What about the variable of fixedImage. I hope it is clear to understand
Thanks a lot
Tony
//-----------------------------------------------------------
// Create the point set and load it with data by sampling
// the fixed image
//-----------------------------------------------------------
typedef itk::PointSet< float, 2 > FixedPointSetType;
FixedPointSetType::Pointer fixedPointSet = FixedPointSetType::New();
const unsigned int numberOfPoints = 10000;
fixedPointSet->SetPointData( FixedPointSetType::PointDataContainer::New() );
fixedPointSet->GetPoints()->Reserve( numberOfPoints );
fixedPointSet->GetPointData()->Reserve( numberOfPoints );
typedef itk::ImageRegionConstIterator< FixedImageType > ImageIteratorType;
ImageIteratorType it( fixedImage, fixedImage->GetBufferedRegion() );
const unsigned int skip =
fixedImage->GetBufferedRegion().GetNumberOfPixels() / numberOfPoints;
unsigned int counter = 0;
FixedPointSetType::PointIdentifier pointId = 0;
FixedPointSetType::PointType point;
it.GoToBegin();
while( !it.IsAtEnd() )
{
if( counter==0 )
{
fixedImage->TransformIndexToPhysicalPoint( it.GetIndex(), point );
fixedPointSet->SetPoint( pointId, point );
fixedPointSet->SetPointData( pointId, it.Get() );
++pointId;
if( pointId == numberOfPoints )
{
break;
}
counter = skip;
}
--counter;
++it;
}
____________________________________________________________________________________
The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070317/c4da5dd6/attachment.html
More information about the Insight-users
mailing list