<div dir="ltr">Further update: when manually increasing the spacing of the input image (without resampling, thus not changing the size), the filter works well. This probably indicates numerical instability depending on image spacing somewhere in the code, which would probably be great if it could be fixed.<div>
<br></div><div>Best,</div><div>Tobias</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-08-12 14:33 GMT+02:00 Tobias Gass <span dir="ltr"><<a href="mailto:gass@vision.ee.ethz.ch" target="_blank">gass@vision.ee.ethz.ch</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Update: meanwhile I also tried cropping the image to investigate the impact of the overall size (#voxels) of the image. It appears to not have an effect, the same artifacts occur when processing a significantly smaller region (1/2 size).</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">2014-08-12 10:44 GMT+02:00 Tobias Gass <span dir="ltr"><<a href="mailto:gass@vision.ee.ethz.ch" target="_blank">gass@vision.ee.ethz.ch</a>></span>:<div><div class="h5">
<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi,<div><br></div><div>changing the PixelType did not yield any change. However, I did some further tests which seem to point at image spacing or total size to be the culprit. My original image is fairly high-res, with 0.25mm in-plane resolution and 0.75mm slice thickness and 512x512x409 voxel size. I tried resampling the image to different isotropic resolutions (0.25, 0.3, 0.34, 0.35, 0.4, 0.5, 0.75, 1)mm isotropic spacing. For all spacings down to 0.35mm, the AA filter converged nicely and the output looks as I'd expect it. Lower than 0.35mm spacing, and it fails in the way I described (from this spacing on the #vox is equal or greater than the #voxels in my original image).</div>
<div><br></div><div>Any idea what might cause this, or what to further investigate?</div><div><br></div><div>Thanks,</div><div>Tobias</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-08-11 22:17 GMT+02:00 Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span>:<div>
<div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Paraview should do the right thing.<br>
<div><div><br>
On Mon, Aug 11, 2014 at 3:38 PM, Tobias Gass <<a href="mailto:gass@vision.ee.ethz.ch" target="_blank">gass@vision.ee.ethz.ch</a>> wrote:<br>
> I will try that tomorrow morning (living in GMT+1). I used paraview to<br>
> extract the isosurface, but also looked at the output of the AA-filter<br>
> directly (which looked fuzzy). I can also post an image of that tomorrow.<br>
><br>
> Thanks for your help!<br>
> Tobias<br>
><br>
><br>
> 2014-08-11 21:22 GMT+02:00 Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>>:<br>
><br>
>> How are you extracting the final isosurface?<br>
>><br>
>> On Mon, Aug 11, 2014 at 3:22 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>><br>
>> wrote:<br>
>> > If you change<br>
>> > typedef short PixelType;<br>
>> > to<br>
>> > typedef double PixelType;<br>
>> ><br>
>> > do the results change.<br>
>> ><br>
>> ><br>
>> > On Mon, Aug 11, 2014 at 2:47 PM, Tobias Gass <<a href="mailto:gass@vision.ee.ethz.ch" target="_blank">gass@vision.ee.ethz.ch</a>><br>
>> > wrote:<br>
>> >><br>
>> >>> Can you post your code. The results do not look correct.<br>
>> >><br>
>> >><br>
>> >> Sure. The {write,read}Image functions are just convenient wrappers for<br>
>> >> the<br>
>> >> respective ITK tools.<br>
>> >><br>
>> >><br>
>> >> #include <stdio.h><br>
>> >><br>
>> >> #include <iostream><br>
>> >><br>
>> >> #include "argstream.h"<br>
>> >><br>
>> >> #include "ImageUtils.h"<br>
>> >><br>
>> >> #include "itkAntiAliasBinaryImageFilter.h"<br>
>> >><br>
>> >> using namespace std;<br>
>> >><br>
>> >> using namespace itk;<br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >> int main(int argc, char ** argv)<br>
>> >><br>
>> >> {<br>
>> >><br>
>> >><br>
>> >> feenableexcept(FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW);<br>
>> >><br>
>> >> typedef short PixelType;<br>
>> >><br>
>> >> typedef double OutputPixelType;<br>
>> >><br>
>> >> const unsigned int D=3;<br>
>> >><br>
>> >> typedef Image<PixelType,D> ImageType;<br>
>> >><br>
>> >><br>
>> >><br>
>> >> typedef ImageType::Pointer ImagePointerType;<br>
>> >><br>
>> >><br>
>> >><br>
>> >> typedef Image<OutputPixelType,D> OutputImageType;<br>
>> >><br>
>> >> typedef OutputImageType::Pointer OutputImagePointerType;<br>
>> >><br>
>> >><br>
>> >><br>
>> >> argstream * as=new argstream(argc,argv);<br>
>> >><br>
>> >> string inFile, outFile;<br>
>> >><br>
>> >> double thresh=0.0;<br>
>> >><br>
>> >> (*as) >> parameter ("in", inFile, " filename...", true);<br>
>> >><br>
>> >> (*as) >> parameter ("out", outFile, " filename...", true);<br>
>> >><br>
>> >><br>
>> >> (*as) >> help();<br>
>> >><br>
>> >> as->defaultErrorHandling();<br>
>> >><br>
>> >><br>
>> >> ImagePointerType img = ImageUtils<ImageType>::readImage(inFile);<br>
>> >><br>
>> >><br>
>> >> typedef itk::AntiAliasBinaryImageFilter <ImageType,<br>
>> >> OutputImageType><br>
>> >><br>
>> >> AntiAliasBinaryImageFilterType;<br>
>> >><br>
>> >><br>
>> >><br>
>> >> AntiAliasBinaryImageFilterType::Pointer antiAliasFilter<br>
>> >><br>
>> >> = AntiAliasBinaryImageFilterType::New ();<br>
>> >><br>
>> >> antiAliasFilter->SetInput(img);<br>
>> >><br>
>> >> antiAliasFilter->SetNumberOfIterations(5);<br>
>> >><br>
>> >> antiAliasFilter->SetMaximumRMSError(0.02);<br>
>> >><br>
>> >><br>
>> >> antiAliasFilter->Update();<br>
>> >><br>
>> >><br>
>> >> // For increased code coverage. Does nothing.<br>
>> >><br>
>> >> antiAliasFilter->GetMaximumRMSError();<br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >> antiAliasFilter->Update();<br>
>> >><br>
>> >><br>
>> >> std::cout << "Maximum RMS change value threshold was: 0.02 " <<<br>
>> >> std::endl;<br>
>> >><br>
>> >> std::cout << "Last RMS change value was: " <<<br>
>> >> antiAliasFilter->GetRMSChange() << std::endl;<br>
>> >><br>
>> >><br>
>> >> std::cout<< antiAliasFilter->GetElapsedIterations() <<endl;<br>
>> >><br>
>> >><br>
>> >> std::cout<<antiAliasFilter->GetLowerBinaryValue()<<" "<<<br>
>> >> antiAliasFilter->GetUpperBinaryValue()<<std::endl;<br>
>> >><br>
>> >><br>
>> >> OutputImagePointerType out=antiAliasFilter->GetOutput();<br>
>> >><br>
>> >><br>
>> >> ImageUtils<OutputImageType>::writeImage(outFile,out);<br>
>> >><br>
>> >><br>
>> >> return 1;<br>
>> >><br>
>> >> }<br>
>> >><br>
>> >><br>
>> >> I tried different values for maxIter (1,2,3,4,5,10,100,1000) and<br>
>> >> maxRMSError<br>
>> >> (0.02 0.07 0.08 0.8), and the best visual results are achieved after<br>
>> >> one<br>
>> >> iteration where RMSE changes by about 0.08. This increases for all<br>
>> >> following<br>
>> >> iterations, which have an RMSE-change of about 0.25 for all number of<br>
>> >> iterations tested. All this is using ITK 4.5 pulled from the GIT<br>
>> >> repository<br>
>> >> a while ago, running on an intel i7 on Debian.<br>
>> >><br>
>> >> Thanks a lot!<br>
>> >> Tobias<br>
>> >><br>
>> >>><br>
>> >>><br>
>> >>> On Mon, Aug 11, 2014 at 12:18 PM, Tobias Gass <<a href="mailto:gass@vision.ee.ethz.ch" target="_blank">gass@vision.ee.ethz.ch</a>><br>
>> >>> wrote:<br>
>> >>> > Dear all,<br>
>> >>> ><br>
>> >>> > I'm having problems using the anti-alias filter, which I want to use<br>
>> >>> > in<br>
>> >>> > order to smooth a binary segmentation volume. I'm using essentially<br>
>> >>> > the<br>
>> >>> > example code from the repository, which for my input file seems to<br>
>> >>> > start<br>
>> >>> > oscillating after 2 iterations, leading to weird 'pointy' artifacts<br>
>> >>> > on<br>
>> >>> > the<br>
>> >>> > surface as can be seen from the attached screenshot (AA filter<br>
>> >>> > output is<br>
>> >>> > on<br>
>> >>> > the left, input on the right).<br>
>> >>> ><br>
>> >>> > Is there any parameter to set/implement which could improve the<br>
>> >>> > behavior<br>
>> >>> > of<br>
>> >>> > this filter? I'm assuming that my input is reasonable, or is this<br>
>> >>> > something<br>
>> >>> > the filter is expected to have problems with? It is notable that<br>
>> >>> > such<br>
>> >>> > errors<br>
>> >>> > seem to mainly appear in 'flat' regions of the volume, and are not<br>
>> >>> > apparent<br>
>> >>> > in the curved shaft of the bone.<br>
>> >>> ><br>
>> >>> > Any help, or pointers to further resources are appreciated,<br>
>> >>> > thanks,<br>
>> >>> > Tobias<br>
>> >>> ><br>
>> >>> > _____________________________________<br>
>> >>> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> >>> ><br>
>> >>> > Visit other Kitware open-source projects at<br>
>> >>> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >>> ><br>
>> >>> > Kitware offers ITK Training Courses, for more information visit:<br>
>> >>> > <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
>> >>> ><br>
>> >>> > Please keep messages on-topic and check the ITK FAQ at:<br>
>> >>> > <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>> >>> ><br>
>> >>> > Follow this link to subscribe/unsubscribe:<br>
>> >>> > <a href="http://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
>> >>> ><br>
>> >>><br>
>> >>><br>
>> >>><br>
>> >>> --<br>
>> >>> Unpaid intern in BillsBasement at noware dot com<br>
>> >><br>
>> >><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Unpaid intern in BillsBasement at noware dot com<br>
>><br>
>><br>
>><br>
>> --<br>
>> Unpaid intern in BillsBasement at noware dot com<br>
><br>
><br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div></div></div><br></div>
</blockquote></div></div></div><br></div>
</blockquote></div><br></div>