<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
Julien,<br><br>I can confirm that this is a bug in the development version of <br>WrapITK--we're working on it.<br><br><br>-Ali<br><br>Julien Jomier wrote:<br>> Hi Ali,<br>><br>> Couple of things:<br>><br>> 1) Change the gaus.GetIndexToObjectTransform().SetTranslation(offset) to<br>> gaus.GetObjectToParentTransform().SetTranslation(offset)<br>><br>> 2) Add gaus.ComputeObjectToWorldTransform(); after setting the <br>> translation. This forces the recomputation of the world transform for <br>> the object.<br>><br>> 3) Don't forget to set the size of your image for the <br>> SpatialObjectToImageFilter using SetSize().<br>><br>> Here's the code I've been using (C++ version)<br>><br>> typedef itk::GaussianSpatialObject<2> GSType;<br>> GSType::Pointer gsp = GSType::New();<br>><br>> gsp->SetMaximum(255);<br>> gsp->SetRadius(7);<br>> typedef itk::Vector<double,2> VectorType;<br>> VectorType v;<br>> v[0] = 10;<br>> v[1] = 10;<br>> gsp->GetObjectToParentTransform()->SetTranslation(v);<br>> gsp->ComputeObjectToWorldTransform();<br>><br>> typedef itk::Image<unsigned char,2> ImageType;<br>> typedef itk::SpatialObjectToImageFilter<GType,ImageType> FilterType;<br>> FilterType::Pointer filter = FilterType::New();<br>> filter->SetInput(gsp);<br>> FilterType::SizeType size;<br>> size[0]=20;<br>> size[1]=20;<br>> filter->SetSize(size);<br>> filter->Update();<br>><br>> typedef itk::ImageFileWriter<ImageType> WriterType;<br>> WriterType::Pointer writer= WriterType::New();<br>> writer->SetFileName("test.jpg");<br>> writer->SetInput(filter->GetOutput());<br>> writer->Update();<br>><br>> Let me know if that works or not,<br>><br>> Julien<br>><br>> Ali - wrote:<br>>> Hi Julien,<br>>><br>>> It seems there is this bug in GaussianSpatialObject which causes to mess<br>>> up the whole spatial object image when the translation transform is<br>>> applied. Here is an example:<br>>><br>>> itkGaussianSpatialObject2 gaus = new itkGaussianSpatialObject2();<br>>> gaus.SetMaximum(255);<br>>> gaus.SetRadius(7);<br>>> itkVectorD2 offset = new itkVectorD2();<br>>> offset.SetElement(0, 0.0);<br>>> offset.SetElement(1, 0.0);<br>>> gaus.GetIndexToObjectTransform().SetTranslation(offset);<br>>><br>>> (The above code is in java, but can be used as a pseudo code). Notice<br>>> that whether the offset is zero or not, setting the translation value<br>>> messes up the gaussian object. Here are the results:<br>>><br>>> Without calling translation: http://i26.tinypic.com/2j4u7pd.jpg<br>>> With calling translation: http://i31.tinypic.com/iwrd5y.jpg<br>>><br>>> All I wanted to do was to have a gaussian object at the centre of the<br>>> image. Is there a better way of doing this?<br>>><br>>><br>>> -Ali<br>>><br>>><br>>><br>>><br>>> ------------------------------------------------------------------------<br>>> Miss your Messenger buddies when on-the-go? Get Messenger on your <br>>> Mobile! <http://clk.atdmt.com/UKM/go/msnnkmgl0010000001ukm/direct/01/><br>><br>><br><br><br><br /><hr />Miss your Messenger buddies when on-the-go? <a href='http://clk.atdmt.com/UKM/go/msnnkmgl0010000001ukm/direct/01/' target='_new'>Get Messenger on your Mobile!</a></body>
</html>