Proof of morphological operations with large images

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Proof of morphological operations with large images

Isaac Perez
Greetings.

I've recently started using ImageJ and I'm still learning to use it.
Install the plugin for mathematical morphology
(http://rsbweb.nih.gov/ij/plugins/gray-morphology.html) and am
starting to try it with some images.

I'm interested in trying morphological operators in histological
images are quite large (3000 x 4000 pixels) and when I apply the
mathematical morphology operators on them the result takes some time
to be generated

Specifically,

Erode:              33.238 sec
Dilate:              34.943 sec
Opening:          67.104 sec
Closing:           70.217 sec
Fast Erode:       8.280 sec
Fast Dilate:       9.166 sec
Fast Opening: 16.442 sec
Fast Closing:  16.432 sec

In this case, all operations were performed using as structuring
element a circle with radius 15 pixels. In particular catches my
attention the time it takes the Opening and Closing (normal versions).

My questions are:

Is it normal morphological operations (especially the Opening and
Closing) take that long to complete?
Can you do something to reduce some of the times?

As I said before, I am new to using ImageJ and therefore do not know
if it is common that these operations take time. Just decided to ask
to be sure.
My computer has an Intel Core i7-2720QM 2.2GHz and 8GB of DDR3 RAM.

Thanks in advance for any answers and / or suggestions.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Proof of morphological operations with large images

Sidnei Paciornik
I suggest you try the Fast Morphology plugin
http://imagejdocu.tudor.lu/doku.php?id=plugin:morphology:fast_morphological_filters:start

I am not particularly impressed with these delays for such large images.

Good luck.

Prof. Sidnei Paciornik
Grupo de Análise de Imagens e Microscopia Digital
DEMa <http://www.dema.puc-rio.br/> - Departamento de Engenharia de Materiais
PUC-Rio <http://www.puc-rio.br/>
Rua Marquês de São Vicente 225
Prédio Leme, Sala 501L
Gávea - Rio de Janeiro - RJ
22451-900 - Brasil
tel: (55)(21)3527-1243





On Sat, Jun 22, 2013 at 8:31 AM, Isaac Perez <[hidden email]>wrote:

> Greetings.
>
> I've recently started using ImageJ and I'm still learning to use it.
> Install the plugin for mathematical morphology
> (http://rsbweb.nih.gov/ij/plugins/gray-morphology.html) and am
> starting to try it with some images.
>
> I'm interested in trying morphological operators in histological
> images are quite large (3000 x 4000 pixels) and when I apply the
> mathematical morphology operators on them the result takes some time
> to be generated
>
> Specifically,
>
> Erode:              33.238 sec
> Dilate:              34.943 sec
> Opening:          67.104 sec
> Closing:           70.217 sec
> Fast Erode:       8.280 sec
> Fast Dilate:       9.166 sec
> Fast Opening: 16.442 sec
> Fast Closing:  16.432 sec
>
> In this case, all operations were performed using as structuring
> element a circle with radius 15 pixels. In particular catches my
> attention the time it takes the Opening and Closing (normal versions).
>
> My questions are:
>
> Is it normal morphological operations (especially the Opening and
> Closing) take that long to complete?
> Can you do something to reduce some of the times?
>
> As I said before, I am new to using ImageJ and therefore do not know
> if it is common that these operations take time. Just decided to ask
> to be sure.
> My computer has an Intel Core i7-2720QM 2.2GHz and 8GB of DDR3 RAM.
>
> Thanks in advance for any answers and / or suggestions.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Proof of morphological operations with large images

Isaac Perez
Greetings.

Thanks for your reply.

I download and install the plugin 'Fast-Morphology'. It is certainly
faster. However, this does not return information on the execution
time of the operators. Mathematical morphology functionalities built
into ImageJ and mathematical morphology plugin it is mentioned in my
initial post have this feature, ie, the execution time of the
operators is shown in the status bar after the operator is applied.

How I can realistically measure the execution time of morphological
filters of the plugin 'fast-morphology'? ... Any ideas?

Again, thanks in advance for any help and / or suggestions.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Proof of morphological operations with large images

Prodanov Dimiter
In reply to this post by Isaac Perez
Hi,

The operations assume non-separable structuring elements, which is the worst case scenario.
If the SEs are separable (rectangular, square) the algorithms can be sped up to run in constant time.
'Fast' versions use histogramming and are more advantageous for large structuring elements.

Another possibility is to parallelize the operations but I haven't done this so-far because multicore processors were not common in 2008 when I released the last update.

Best regards,

Dimiter Prodanov

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Proof of morphological operations with large images

Miguel Angel Veganzones
Dear Dimiter,
I'm interested in reading more about fast morphological operations. Could
you please suggest me any paper on the topic?
Thanks in advance
Best regards
Miguel A. Veganzones


2013/6/24 Prodanov Dimiter <[hidden email]>

> Hi,
>
> The operations assume non-separable structuring elements, which is the
> worst case scenario.
> If the SEs are separable (rectangular, square) the algorithms can be sped
> up to run in constant time.
> 'Fast' versions use histogramming and are more advantageous for large
> structuring elements.
>
> Another possibility is to parallelize the operations but I haven't done
> this so-far because multicore processors were not common in 2008 when I
> released the last update.
>
> Best regards,
>
> Dimiter Prodanov
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
=====================================================
Dr. Miguel Angel Veganzones
Post-doctoral researcher
GIPSA-lab, Grenoble-INP, France

Domaine Universitaire
11 rue des mathématiques BP 46
38402 Saint Martin d'Hères Cedex

Bureau D1145
Mail : [hidden email]
http://www.gipsa-lab.grenoble-inp.fr/page_pro.php?vid=1728
Tél.:  33 (0)4 76 82 63 96
Fax : 33 (0)4 76 57 47 90
=====================================================

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Proof of morphological operations with large images

Michael Schmid
In reply to this post by Isaac Perez
Hi Isaac,

for opening and closing with circular structuring element you can also use the built-in ImageJ Minimum and Maximum filters. I think that they are optimized quite well (hmm - some self-praise, I did much of the code). The time taken by them depends on the image contents: the more detail you have in the filtered image, the longer they take. For a typical image I would expect processing times well below 10 sec for 3000*4000 pixels with r=15 on an i7 machine.

Opening and Closing is just a combination of sequential Minimum and Maximum or reverse.

For a rectangular (also square, or single line) structuring element, you can use my Fast Filters plugin. There, opening and closing are available as 'Eliminate maxima' and 'Eliminate minima'. Since minimum and maximum with a rectangular structuring element is separable into sequential operations in x and y, this is much faster.

http://imagejdocu.tudor.lu/doku.php?id=plugin:filter:fast_filters:start


Both, the built-in filters of ImageJ and the Fast Filters plugin use parallel processing in multi-core machines.

If you need a structuring element that is different from a circle, you may also take the sources of the built-in ImageJ Rank_Filters and modify them. This should work for all structural elements that are equal to their convex hull (and a few others), e.g. any convex polygon shapes. It won't work for non-contiguous structural elements.

--

You get the computing speed displayed for all ImageJ plugins that implement the PlugInFilter or ExtendedPlugInFilter interface. Otherwise, to avoid counting the time for the dialog, I would suggest recording the commands as a macro (Plugins>Macros>Record). Then write a short macro around it:

  t0 = getTime();
  run("my_command_to_test", "radius=15 otherParameters");
  t1 = getTime();
  seconds=(t1-t0)*0.001;
  print("Time taken: "+seconds);

For plugins that are not a(n) (Extended)PlugInFilter (and do not show the computing time), beware that the result of some of these plugins may be incorrect if there is a paste operation in the image preceding the operation of the plugin.


Michael
________________________________________________________________
On Jun 22, 2013, at 13:31, Isaac Perez wrote:

> Greetings.
>
> I've recently started using ImageJ and I'm still learning to use it.
> Install the plugin for mathematical morphology
> (http://rsbweb.nih.gov/ij/plugins/gray-morphology.html) and am
> starting to try it with some images.
>
> I'm interested in trying morphological operators in histological
> images are quite large (3000 x 4000 pixels) and when I apply the
> mathematical morphology operators on them the result takes some time
> to be generated
>
> Specifically,
>
> Erode:              33.238 sec
> Dilate:              34.943 sec
> Opening:          67.104 sec
> Closing:           70.217 sec
> Fast Erode:       8.280 sec
> Fast Dilate:       9.166 sec
> Fast Opening: 16.442 sec
> Fast Closing:  16.432 sec
>
> In this case, all operations were performed using as structuring
> element a circle with radius 15 pixels. In particular catches my
> attention the time it takes the Opening and Closing (normal versions).
>
> My questions are:
>
> Is it normal morphological operations (especially the Opening and
> Closing) take that long to complete?
> Can you do something to reduce some of the times?
>
> As I said before, I am new to using ImageJ and therefore do not know
> if it is common that these operations take time. Just decided to ask
> to be sure.
> My computer has an Intel Core i7-2720QM 2.2GHz and 8GB of DDR3 RAM.
>
> Thanks in advance for any answers and / or suggestions.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html