Hi Luis,<br> thanks for the reply again! Unfortunately I cannot post the data or the results, it has got commercial value (**proprietary**)! <br><br>You are absolutely correct with regards to messing around with the the time step though! It shouldn't be much of a problem running with a smaller time step, the only caveat being a longer time for computations! That being said that is exactly what I did for testing too and I did not find anything suspect qualitatively (like you said) or quantitatively (in a rms perspective between the voxels). Maybe I'll just code up a implicit method for double checking. In terms of development though I am certainly going to stick with the smaller time step restriction!<br>
<br>Please forgive my thread etiquette about this next question but I noticed a strange memory issue when I run anisotropic diffusion on a dataset that is 1024^3. The dataset is 2GB but I noticed that 14GB was being used! Isn't this odd? I have not probed the code to find out where and why, so if there is an obvious answer my apologies, just seeing if there is a quick and dirty answer!<br>
<br>Cheers,<br><br>C.S.N<br>
<br><div class="gmail_quote">On Wed, Feb 17, 2010 at 5:24 PM, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Natarajan,<br>
<br>
Thanks for letting us know of your experiments.<br>
<br>
I would be curious to see if the images that you used<br>
as input had enough high contrast edges and thin spatial<br>
features that would make visible the artifact that we are<br>
concerned about.<br>
<br>
Being pragmatic, you should be able to obtain a similar<br>
degree of smoothing by running the filter with the smaller<br>
time-step that is currently defined in ITK, and double the<br>
number of iterations.<br>
<br>
The limit in the time-step is the one at which the conditions<br>
of stability break down. Playing in that borderline may not<br>
be a good way of using the code.<br>
<br>
<br>
BTW:Thanks for posting the link to the report.<br>
<br>
<br>
Regards,<br>
<br>
<br>
Luis<br>
<br>
<br>
----------------------------------------------------------------------------------<br>
<div><div></div><div>On Tue, Feb 16, 2010 at 11:14 PM, Natarajan CS <<a href="mailto:csnataraj@gmail.com" target="_blank">csnataraj@gmail.com</a>> wrote:<br>
> Hello Luis,<br>
> just an update on the time step question. For my data I don't see any<br>
> undesirable side effects like what you described. I also tested<br>
> corresponding values for a 2D image, same thing! It seems that <=<br>
> 1/2^dimension should work! However, this comes with the caveat that image<br>
> analysis is not my expertise!! It would be nice to get a affirmation from a<br>
> more reliable source!<br>
><br>
> Nonetheless, I really appreciate you guys making ITK open source and being<br>
> great with answering questions!<br>
><br>
> Cheers,<br>
><br>
> C.S.N<br>
><br>
><br>
> On Mon, Feb 15, 2010 at 5:01 PM, Natarajan CS <<a href="mailto:csnataraj@gmail.com" target="_blank">csnataraj@gmail.com</a>> wrote:<br>
>><br>
>> Hi Luis,<br>
>> sure, sounds like a good plan. I am heading out right now, but<br>
>> hopefully I should be able to get it done by tomorrow! I will try with time<br>
>> steps at 1/2^N, 1/2^(N+1), and 1.5/2^N and send out another e-mail.<br>
>><br>
>> Cheers,<br>
>><br>
>> C.S.N<br>
>><br>
>> P.S :- Just in case anyone is interested, the paper is available as a tech<br>
>> report from Berkeley<br>
>><br>
>> <a href="http://digitalassets.lib.berkeley.edu/techreports/ucb/text/CSD-88-483.pdf" target="_blank">http://digitalassets.lib.berkeley.edu/techreports/ucb/text/CSD-88-483.pdf</a><br>
>><br>
>><br>
>> On Mon, Feb 15, 2010 at 3:58 PM, Luis Ibanez <<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>><br>
>> wrote:<br>
>>><br>
>>> Hi Natarajan,<br>
>>><br>
>>> You are right, the code is actually testing for<br>
>>><br>
>>> 1/2^(N+1)<br>
>>><br>
>>> not for<br>
>>><br>
>>> 1/2^(N)<br>
>>><br>
>>> as I incorrectly wrote in my email.<br>
>>><br>
>>><br>
>>> This filter is intended to be the implementation of<br>
>>> the Perona-Malik method, as described in:<br>
>>><br>
>>> * Pietro Perona and Jalhandra Malik, ``Scale-space and edge detection<br>
>>> using<br>
>>> * anisotropic diffusion,'' IEEE Transactions on Pattern Analysis Machine<br>
>>> * Intelligence, vol. 12, pp. 629-639, 1990.<br>
>>><br>
>>><br>
>>> I don't have at hand the Perona Malik paper,<br>
>>> so let's do this:<br>
>>><br>
>>><br>
>>> Could you please modify the code locally in your ITK code,<br>
>>> and run it with a couple of cases, using a timestep that is<br>
>>> in the range:<br>
>>><br>
>>> 1/2^(N+1) < t < 1/2^(N)<br>
>>><br>
>>> and let us know if the output looks correct ?<br>
>>><br>
>>> ---<br>
>>><br>
>>> Typically when you use a timestep that is too large, you<br>
>>> will see intensity artifacts that look like rhomboids in the<br>
>>> borders of the objects in the image.<br>
>>><br>
>>><br>
>>> Please let us know what you find,<br>
>>><br>
>>><br>
>>> Thanks<br>
>>><br>
>>><br>
>>> Luis<br>
>>><br>
>>><br>
>>><br>
>>> ---------------------------------------------------------------------------<br>
>>> On Mon, Feb 15, 2010 at 3:34 PM, Natarajan CS <<a href="mailto:csnataraj@gmail.com" target="_blank">csnataraj@gmail.com</a>><br>
>>> wrote:<br>
>>> > Hi Luis,<br>
>>> > thanks for the quick reply. Nope, I do not believe I have enabled<br>
>>> > this<br>
>>> > flag. I am confused, I did take a look at the code snippet you<br>
>>> > suggested and<br>
>>> > figured that time step is <= 1/2^(N+1) not 1/2^N (Judging from line 75<br>
>>> > and/through 81). In reality I believe this has to be 1/2^N as you<br>
>>> > suggested,<br>
>>> > at least if the implementation is same as Perona and Malik..<br>
>>> ><br>
>>> > just in case my metadata looks as follows :<br>
>>> ><br>
>>> > NDims = 3<br>
>>> > DimSize = 256 256 256<br>
>>> > ElementType = MET_SHORT<br>
>>> > ElementDataFile = raw256.raw<br>
>>> ><br>
>>> ><br>
>>> > Again, thanks for the help!<br>
>>> ><br>
>>> > Cheers,<br>
>>> ><br>
>>> > C.S.N<br>
>>> ><br>
>>> ><br>
>>> ><br>
>>> > On Mon, Feb 15, 2010 at 2:00 PM, Luis Ibanez <<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>><br>
>>> > wrote:<br>
>>> >><br>
>>> >> Hi Natarajan,<br>
>>> >><br>
>>> >><br>
>>> >><br>
>>> >> "Glimpsing at the Source, leaves no doubt"<br>
>>> >><br>
>>> >><br>
>>> >> This is what the file:<br>
>>> >><br>
>>> >><br>
>>> >> Insight/Code/BasicFilters/itkAnisotropicDiffusionImageFilter.txx<br>
>>> >><br>
>>> >> has in lines 75-82:<br>
>>> >><br>
>>> >><br>
>>> >> if ( m_TimeStep > (minSpacing / vcl_pow(2.0,<br>
>>> >> static_cast<double>(ImageDimension) + 1)) )<br>
>>> >> {<br>
>>> >> // f->SetTimeStep(1.0 / vcl_pow(2.0,<br>
>>> >> static_cast<double>(ImageDimension)));<br>
>>> >> itkWarningMacro( << "Anisotropic diffusion unstable time step: "<br>
>>> >> << m_TimeStep << std::endl<br>
>>> >> << "Stable time step for this image must be<br>
>>> >> smaller<br>
>>> >> than "<br>
>>> >> << minSpacing / vcl_pow(2.0,<br>
>>> >> static_cast<double>(ImageDimension+1)));<br>
>>> >> }<br>
>>> >><br>
>>> >><br>
>>> >> In summary:<br>
>>> >><br>
>>> >> Timestep < pixelSpacing / ( 2^N )<br>
>>> >><br>
>>> >> where N is the image dimension (e.g. 3 for 3D images, and 2 for 2D<br>
>>> >> images).<br>
>>> >><br>
>>> >><br>
>>> >><br>
>>> >><br>
>>> >> Did you enable the flag:<br>
>>> >><br>
>>> >> UseImageSpacing ?<br>
>>> >><br>
>>> >> If so, what is the pixel spacing of your image ?<br>
>>> >><br>
>>> >><br>
>>> >> Regards,<br>
>>> >><br>
>>> >><br>
>>> >><br>
>>> >> Luis<br>
>>> >><br>
>>> >><br>
>>> >> -------------------------------------------<br>
>>> >> On Mon, Feb 15, 2010 at 12:27 PM, Natarajan CS <<a href="mailto:csnataraj@gmail.com" target="_blank">csnataraj@gmail.com</a>><br>
>>> >> wrote:<br>
>>> >> > Hello all,<br>
>>> >> > Not sure if this is a bug or a implementation detail I am<br>
>>> >> > overlooking,<br>
>>> >> > I am tending towards the latter, so any info would be helpful !<br>
>>> >> > I get the following warning from the<br>
>>> >> > GradientAnisotropicDiffusionImageFilter (The filter is being applied<br>
>>> >> > to<br>
>>> >> > a<br>
>>> >> > 256^3 dataset of type short)<br>
>>> >> ><br>
>>> >> > WARNING: In<br>
>>> >> ><br>
>>> >> ><br>
>>> >> > /hpc/soft/natac0/itk/include/InsightToolkit/BasicFilters/itkAnisotropicDiffusionImageFilter.txx,<br>
>>> >> > line 78<br>
>>> >> > GradientAnisotropicDiffusionImageFilter (0xbc4120): Anisotropic<br>
>>> >> > diffusion<br>
>>> >> > unstable time step: 0.07<br>
>>> >> > Stable time step for this image must be smaller than 0.0625<br>
>>> >> ><br>
>>> >> > i was under the impression that the ITK implimentation was a<br>
>>> >> > explicit<br>
>>> >> > method<br>
>>> >> > with the time step requirement for 3D images is <= 1/8 and <= 1/4<br>
>>> >> > for<br>
>>> >> > 2D. Am<br>
>>> >> > i completely off-track here?<br>
>>> >> ><br>
>>> >> > Appreciate any help!<br>
>>> >> ><br>
>>> >> > Thanks,<br>
>>> >> ><br>
>>> >> > C.S.N<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.html" target="_blank">http://www.kitware.com/products/protraining.html</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://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>>> >> ><br>
>>> >> ><br>
>>> ><br>
>>> ><br>
>><br>
><br>
><br>
</div></div></blockquote></div><br>