[Insight-users] Gradient anisotropic filter time step?

Natarajan CS csnataraj at gmail.com
Thu Feb 18 11:41:12 EST 2010


Hi Luis,
      thanks for the reply again! Unfortunately I cannot post the data or
the results, it has got commercial value (**proprietary**)!

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!

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!

Cheers,

C.S.N

On Wed, Feb 17, 2010 at 5:24 PM, Luis Ibanez <luis.ibanez at kitware.com>wrote:

> Hi Natarajan,
>
> Thanks for letting us know of your experiments.
>
> I would be curious to see if the images that you used
> as input had enough high contrast edges and thin spatial
> features that would make visible the artifact that we are
> concerned about.
>
> Being pragmatic, you should be able to obtain a similar
> degree of smoothing by running the filter with the smaller
> time-step that is currently defined in ITK, and double the
> number of iterations.
>
> The limit in the time-step is the one at which the conditions
> of stability break down. Playing in that borderline may not
> be a good way of using the code.
>
>
>  BTW:Thanks for posting the link to the report.
>
>
>            Regards,
>
>
>                   Luis
>
>
>
> ----------------------------------------------------------------------------------
> On Tue, Feb 16, 2010 at 11:14 PM, Natarajan CS <csnataraj at gmail.com>
> wrote:
> > Hello Luis,
> >      just an update on the time step question. For my data I don't see
> any
> > undesirable side effects like what you described. I also tested
> > corresponding values for a 2D image, same thing! It seems that <=
> > 1/2^dimension should work! However, this comes with the caveat that image
> > analysis is not my expertise!! It would be nice to get a affirmation from
> a
> > more reliable source!
> >
> > Nonetheless, I really appreciate you guys making ITK open source and
> being
> > great with answering questions!
> >
> > Cheers,
> >
> > C.S.N
> >
> >
> > On Mon, Feb 15, 2010 at 5:01 PM, Natarajan CS <csnataraj at gmail.com>
> wrote:
> >>
> >> Hi Luis,
> >>       sure, sounds like a good plan. I am heading out right now, but
> >> hopefully I should be able to get it done by tomorrow! I will try with
> time
> >> steps at 1/2^N, 1/2^(N+1), and 1.5/2^N and send out another e-mail.
> >>
> >> Cheers,
> >>
> >> C.S.N
> >>
> >> P.S :- Just in case anyone is interested, the paper is available as a
> tech
> >> report from Berkeley
> >>
> >>
> http://digitalassets.lib.berkeley.edu/techreports/ucb/text/CSD-88-483.pdf
> >>
> >>
> >> On Mon, Feb 15, 2010 at 3:58 PM, Luis Ibanez <luis.ibanez at kitware.com>
> >> wrote:
> >>>
> >>> Hi Natarajan,
> >>>
> >>> You are right, the code is actually testing for
> >>>
> >>>                        1/2^(N+1)
> >>>
> >>> not for
> >>>
> >>>                           1/2^(N)
> >>>
> >>> as I incorrectly wrote in my email.
> >>>
> >>>
> >>> This filter is intended to be the implementation of
> >>> the Perona-Malik method, as described in:
> >>>
> >>>  * Pietro Perona and Jalhandra Malik, ``Scale-space and edge detection
> >>> using
> >>>  * anisotropic diffusion,'' IEEE Transactions on Pattern Analysis
> Machine
> >>>  * Intelligence, vol. 12, pp. 629-639, 1990.
> >>>
> >>>
> >>> I don't have at hand the Perona Malik paper,
> >>> so let's do this:
> >>>
> >>>
> >>> Could you please modify the code locally in your ITK code,
> >>> and run it with a couple of cases, using a timestep that is
> >>> in the range:
> >>>
> >>>                    1/2^(N+1)  <  t  < 1/2^(N)
> >>>
> >>> and let us know if the output looks correct ?
> >>>
> >>> ---
> >>>
> >>> Typically when you use a timestep that is too large, you
> >>> will see intensity artifacts that look like rhomboids in the
> >>> borders of the objects in the image.
> >>>
> >>>
> >>>     Please let us know what you find,
> >>>
> >>>
> >>>            Thanks
> >>>
> >>>
> >>>                 Luis
> >>>
> >>>
> >>>
> >>>
> ---------------------------------------------------------------------------
> >>> On Mon, Feb 15, 2010 at 3:34 PM, Natarajan CS <csnataraj at gmail.com>
> >>> wrote:
> >>> > Hi Luis,
> >>> >      thanks for the quick reply. Nope, I do not believe I have
> enabled
> >>> > this
> >>> > flag. I am confused, I did take a look at the code snippet you
> >>> > suggested and
> >>> > figured that time step is <= 1/2^(N+1) not 1/2^N (Judging from line
> 75
> >>> > and/through 81). In reality I believe this has to be 1/2^N as you
> >>> > suggested,
> >>> > at least if the implementation is same as Perona and Malik..
> >>> >
> >>> > just in case my metadata looks as follows :
> >>> >
> >>> > NDims = 3
> >>> > DimSize = 256 256 256
> >>> > ElementType = MET_SHORT
> >>> > ElementDataFile = raw256.raw
> >>> >
> >>> >
> >>> > Again, thanks for the help!
> >>> >
> >>> > Cheers,
> >>> >
> >>> > C.S.N
> >>> >
> >>> >
> >>> >
> >>> > On Mon, Feb 15, 2010 at 2:00 PM, Luis Ibanez <
> luis.ibanez at kitware.com>
> >>> > wrote:
> >>> >>
> >>> >> Hi Natarajan,
> >>> >>
> >>> >>
> >>> >>
> >>> >>                      "Glimpsing at the Source, leaves no doubt"
> >>> >>
> >>> >>
> >>> >> This is what the file:
> >>> >>
> >>> >>
> >>> >> Insight/Code/BasicFilters/itkAnisotropicDiffusionImageFilter.txx
> >>> >>
> >>> >> has in lines 75-82:
> >>> >>
> >>> >>
> >>> >>  if ( m_TimeStep >  (minSpacing / vcl_pow(2.0,
> >>> >> static_cast<double>(ImageDimension) + 1))  )
> >>> >>    {
> >>> >>    //    f->SetTimeStep(1.0 / vcl_pow(2.0,
> >>> >> static_cast<double>(ImageDimension)));
> >>> >>    itkWarningMacro( << "Anisotropic diffusion unstable time step: "
> >>> >>                     << m_TimeStep << std::endl
> >>> >>                     << "Stable time step for this image must be
> >>> >> smaller
> >>> >> than "
> >>> >>                     << minSpacing / vcl_pow(2.0,
> >>> >> static_cast<double>(ImageDimension+1)));
> >>> >>    }
> >>> >>
> >>> >>
> >>> >> In summary:
> >>> >>
> >>> >>                    Timestep    <     pixelSpacing  /  ( 2^N )
> >>> >>
> >>> >> where N is the image dimension (e.g. 3 for 3D images, and 2 for 2D
> >>> >> images).
> >>> >>
> >>> >>
> >>> >>
> >>> >>
> >>> >> Did you enable the flag:
> >>> >>
> >>> >>               UseImageSpacing  ?
> >>> >>
> >>> >> If so, what is the pixel spacing of your image ?
> >>> >>
> >>> >>
> >>> >>      Regards,
> >>> >>
> >>> >>
> >>> >>
> >>> >>            Luis
> >>> >>
> >>> >>
> >>> >> -------------------------------------------
> >>> >> On Mon, Feb 15, 2010 at 12:27 PM, Natarajan CS <csnataraj at gmail.com
> >
> >>> >> wrote:
> >>> >> > Hello all,
> >>> >> >       Not sure if this is a bug or a implementation detail I am
> >>> >> > overlooking,
> >>> >> > I am tending towards the latter, so any info would be helpful !
> >>> >> >  I get  the following warning from the
> >>> >> > GradientAnisotropicDiffusionImageFilter (The filter is being
> applied
> >>> >> > to
> >>> >> > a
> >>> >> > 256^3 dataset of type short)
> >>> >> >
> >>> >> > WARNING: In
> >>> >> >
> >>> >> >
> >>> >> >
> /hpc/soft/natac0/itk/include/InsightToolkit/BasicFilters/itkAnisotropicDiffusionImageFilter.txx,
> >>> >> > line 78
> >>> >> > GradientAnisotropicDiffusionImageFilter (0xbc4120): Anisotropic
> >>> >> > diffusion
> >>> >> > unstable time step: 0.07
> >>> >> > Stable time step for this image must be smaller than 0.0625
> >>> >> >
> >>> >> > i was under the impression that the ITK implimentation was a
> >>> >> > explicit
> >>> >> > method
> >>> >> > with the time step requirement for 3D images is <= 1/8 and <= 1/4
> >>> >> > for
> >>> >> > 2D. Am
> >>> >> > i completely off-track here?
> >>> >> >
> >>> >> > Appreciate any help!
> >>> >> >
> >>> >> > Thanks,
> >>> >> >
> >>> >> > C.S.N
> >>> >> >
> >>> >> > _____________________________________
> >>> >> > Powered by www.kitware.com
> >>> >> >
> >>> >> > Visit other Kitware open-source projects at
> >>> >> > http://www.kitware.com/opensource/opensource.html
> >>> >> >
> >>> >> > Kitware offers ITK Training Courses, for more information visit:
> >>> >> > http://www.kitware.com/products/protraining.html
> >>> >> >
> >>> >> > Please keep messages on-topic and check the ITK FAQ at:
> >>> >> > http://www.itk.org/Wiki/ITK_FAQ
> >>> >> >
> >>> >> > Follow this link to subscribe/unsubscribe:
> >>> >> > http://www.itk.org/mailman/listinfo/insight-users
> >>> >> >
> >>> >> >
> >>> >
> >>> >
> >>
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100218/feef1a27/attachment.htm>


More information about the Insight-users mailing list