MIP- maximum intensity projection

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
alosca
Posts: 52
Joined: 2010-03-04T17:54:57-07:00
Authentication code: 8675308
Location: Pasadena, California

Re: MIP- maximum intensity projection

Post by alosca »

agreed, -min and -max would be better even though +/-mip is clear to me too...
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MIP- maximum intensity projection

Post by magick »

Ok, we'll change it to -min * -max in the next point release.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MIP- maximum intensity projection

Post by magick »

Should that be -max or -max-intensity?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: MIP- maximum intensity projection

Post by fmw42 »

magick wrote:Should that be -max or -max-intensity?

I like the simpler names, just -min and -max ( or -minimum and -maximum). That is my suggestion and preference. But I can live with it the other way, too.

To me, -minimum and -maximum are just like -average. The represent the pixel-by-pixel mathematical operation that will be done among all the input images.

But get user alosca's opinion.

Fred
alosca
Posts: 52
Joined: 2010-03-04T17:54:57-07:00
Authentication code: 8675308
Location: Pasadena, California

Re: MIP- maximum intensity projection

Post by alosca »

-min and -max is as clear as -average so my vote goes to them.

what might be even more complete is to have something like "-arithmetic function [optional]" where function is one of a set of predefined arithmetic operations over the image pixels, for example min, max, mean, sum, and bitwise operations as in or, xor, and [optional] is to account for another possible way to interpret the function as in '-arithmetic max 100' where the operation is done as in max(100,u[0],u[1],...,u[n]).

obs: i was expecting "-evaluate max 100" to do the same thing but it is not working: the histogram of the resulting image has many values < 100. what am i missing ?

[50] : convert -version
Version: ImageMagick 6.4.5 2009-06-04 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: MIP- maximum intensity projection

Post by fmw42 »

obs: i was expecting "-evaluate max 100" to do the same thing but it is not working: the histogram of the resulting image has many values < 100. what am i missing ?
-evaluate max 100

operates on one image only and compares each pixel in that image to the gray level of 100 and takes the max(pixel,100)
alosca
Posts: 52
Joined: 2010-03-04T17:54:57-07:00
Authentication code: 8675308
Location: Pasadena, California

Re: MIP- maximum intensity projection

Post by alosca »

fmw42 wrote:
obs: i was expecting "-evaluate max 100" to do the same thing but it is not working: the histogram of the resulting image has many values < 100. what am i missing ?
-evaluate max 100

operates on one image only and compares each pixel in that image to the gray level of 100 and takes the max(pixel,100)
exactly, and it is not working for me: "convert a.pgm -evaluate max 200 b.pgm" results in b.pgm having all pixel values of a.pgm. same with you ? i will open a new thread on this.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: MIP- maximum intensity projection

Post by fmw42 »

If you are on IM Q16, then the max values range from 0 - 65535. So 200 is very small, so no change will be noticed.

It is better to use % values.

Try a test something like

convert rose: -evaluate max 50% rose_max50pct.png

or better

convert -size 100x100 gradient: -evaluate max 50% grad_max50pct.png


That should be noticeable - anything in the image less than graylevel 50% in each channel will be set to 50%

P.S. About -minimum and -maximum (mip), see viewtopic.php?f=3&t=15718
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MIP- maximum intensity projection

Post by magick »

Instead of -minimum / -maximum, we added the -evaluate-sequence option that behaves like -evaluate but for an image sequence rather than a single image. For example, -evaluate-sequence min, -evaluate-sequence max, and -evaluate-sequence mean.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: MIP- maximum intensity projection

Post by anthony »

magick wrote:Composite only accepts 2 or 3 images (image1, image2, mask). You can composite as many images as you want with the convert command by repeating the -compose operator.
However the -layers operator (and its shortcuts -flatten -mosaic) will compose a whole sequence of images down to one image using the current -compose setting. However you will also need to set an appropriate -background color for the starting image.

Eg composition of
convert image1 image2 image3 image4 -background black -compose lighten -mosaic result.png
is
create a black background canvas (the final size to hold all images - mosaic defintion)
image1 compose onto canvas
image2 onto canvas
image3 onto canvas
image4 onto canvas
replace image sequence with just the resulting canvas composition.

See Layering Images
http://www.imagemagick.org/Usage/layers/#flatten

ASIDE: the meta data of the first image will be preserved in the background image.

This will work with ANY sized images, and can even have different -page (virtual canvas) offsets for each image.
It is much more flexible than the new operators, whcih would be more a quick convenience function.

Of course a 'mean' or 'average' of all images is not so simple unless a HDRI version of IM and number of images being averaged is also known.


This is NOT to say that a -evaluate-sequence operator is any less useful. Such a operator allows the easier addition of new methods.

For example how about a 'biased addition' for images with a 50% bias level (or perhaps as per the current -bias seting). See example of this in
IM Examples, Transforms, Image Mathematics, Adding Biased Gradients
http://www.imagemagick.org/Usage/transf ... h_addition
Which was used for an explanation of Fast Forier Transforms,
http://www.imagemagick.org/Usage/fourier/#waves
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: MIP- maximum intensity projection

Post by fmw42 »

Anthony wrote:Such a operator allows the easier addition of new methods.
It is not exactly the same, but what would be most useful would be a multi-image weighted sum. That would be somewhat like -average, but the user could supply wts and have the images added together by the weights. Perhaps Anthony's new kernel code used for -morphology could be used to supply the weights, since there are an arbitrary (even or odd number of them) in a 1D-like series. This would allow me to speed up some scripts that rely upon -fx with multiple input images. Its utility comes from the fact that without it, if you have some images that need negative wts, they can get clipped in doing them in pairs. It is not urgent however. Just thought I would suggest that here for future consideration as an enhancement.
Post Reply