<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>Sorry about the ambiguity, I used .bmp extension with vtkImageWriter, so <br>I guess vtkBMPWriter could produce the problem here on windows. Gaetan <br>has conformed the the problem happens for vtkJPEGWriter and vtkPNGWriter <br>as well on linux--this should be a separate problem.<br><br>I was trying to create a minimal pipeline which could demonstrate the <br>bug, unfortunately, whatever minimal example I tried so far demonstrated <br>any other bugs but the bug of interest. Since most of the bugs are <br>concentrated around the sticky ItkVtkGlue code, we'll focus on this for <br>now. Thank you for your help.<br><br><br>-Ali<br><br>Julien Jomier wrote:<br>> Ali,<br>><br>> The vtkImageWriter is a superclass for the other file formats, I don't <br>> know what you want me to try.<br>><br>> Julien<br>><br>> Ali - wrote:<br>>> Julien,<br>>><br>>> Thanks for trying this, the Update() of SpatialObjectToImageFilter<br>>> method is called was called during the test. Could you give it a try<br>>> with vtkImageWriter instead of vtkJPEGWriter The minimal pipeline could<br>>> produce the bug for Gaetan and I when it was ended with that filter.<br>>><br>>><br>>> -Ali<br>>><br>>> Julien Jomier wrote:<br>>> > Ali,<br>>> ><br>>> > I just tried adding ItkVtk and having vtkJPEGWriter at the end of the<br>>> > pipeline and it works fine.<br>>> ><br>>> > Are you calling Update() explicitly on the <br>>> SpatialObjectToImageFilter?<br>>> > That might be the source of the problem.<br>>> ><br>>> > Julien<br>>> ><br>>> > Ali - wrote:<br>>> >> Julien,<br>>> >><br>>> >> This seems to be one of those hard-to-detect bugs, now we know <br>>> that it<br>>> >> is very unlikely that wrapping causes the problem. This is a minimal<br>>> >> pipeline which can generate the bug:<br>>> >><br>>> >> [itk::GaussianSpatialObject] -> [itk::SpatialObjectToImageFilter] -><br>>> >> [itkImageToVTKImageFilter] -> [vtkWriter]<br>>> >><br>>> >> The reason that you have never encountered this problem in ITK is <br>>> that<br>>> >> the pipelines normally end with an ITK writer. However, after <br>>> passing<br>>> >> the image buffer to a VTK writer, the output file is broken.<br>>> >><br>>> >> One may argue that this is an ItkVtkGlue bug, but the fact that <br>>> we have<br>>> >> not observed anything similar in all other image filters suggests <br>>> that<br>>> >> there is something different in SpatialObjectToImageFilter. Is it<br>>> >> possible that some, possibly optional, step is not performed in<br>>> >> SpatialObjectToImageFilter? If you can try this with ItkVtkGlue, <br>>> it'd be<br>>> >> a big help to us.<br>>> >><br>>> >><br>>> >> -Ali<br>>> >><br>>> >><br>>> >> Julien Jomier wrote:<br>>> >>> Hi Ali,<br>>> >>><br>>> >>> Couple of things:<br>>> >>><br>>> >>> 1) Change the<br>>> >> 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 <br>>> 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 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 ImageType;<br>>> >>> typedef itk::SpatialObjectToImageFilter 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 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<br>>> >> to mess<br>>> >>>> up the whole spatial object image when the translation <br>>> 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).<br>>> >> Notice<br>>> >>>> that whether the offset is zero or not, setting the translation<br>>> >> 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<br>>> >> the<br>>> >>>> image. Is there a better way of doing this?<br>>> >>>><br>>> >>>><br>>> >>>> -Ali<br>>> >>>><br>>> >>>><br>>> >>>><br>>> >>>><br>>> >>>><br>>> >> <br>>> ------------------------------------------------------------------------<br>>> >>>> Miss your Messenger buddies when on-the-go? Get Messenger on your<br>>> >>>> Mobile!<br>>> >>><br>>> >>><br>>> >><br>>> >><br>>> >><br>>> >> <br>>> ------------------------------------------------------------------------<br>>> >> Messenger's gone Mobile! Get it now!<br>>> >><br>>> ><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 />Get fish-slapping on Messenger! <a href='http://clk.atdmt.com/UKM/go/msnnkmgl0010000008ukm/direct/01/' target='_new'>Play Now</a></body>
</html>