http://imagej.273.s1.nabble.com/Normalising-XY-data-by-Z-direction-in-stacks-tp3685096p3685100.html
> Thanks Neil, That was all the pointer I needed to get a modified
> version of your code snippet to do what I needed. Next will be to
> think about effective processing order to maximise speed .... Code
> below if anyone is interested:
>
> // Make sure image accepts floating point values
>
> run("32-bit");
>
> // get image width x
> x = getWidth;
> // get image height y
> y = getHeight;
> // get image depth z
> z = nSlices;
>
> for (i=0; i < x; i++){
> for (j=0; j < y; j++){
> // Get max and min value in the x-y coord
> maxValue = 0;
> minValue = 10000;
> for (k=1; k <= z; k++){
>
> setSlice(k);
> currValue = getPixel(i, j);
> if (currValue > maxValue){
> maxValue = currValue;
> }
> if (currValue < minValue){
> minValue = currValue;
> }
> }
> // Set new value normalised to max value
> for (k=1; k <= z; k++){
> setSlice(k);
> currPixelValue = getPixel(i,j);
> newPixelValue = (currPixelValue-(minValue))/(maxValue-minValue);
> putPixel(i, j, (newPixelValue));
> }
> }
> }
>
> Much appreciated,
>
> Cheers
>
> James
>
> Dr James Cleverley
> Senior Geochemist
> Stream Leader | Mineral Systems & Targeting
> Minerals Down Under Research Flagship
> CSIRO Earth Science & Resource Engineering
> Phone: +61 864368714 | Mobile: 0408 180972
>
[hidden email] | www.csiro.au | www.csiro.au/
> Address: Australian Resources Research Centre, PO Box 1130,
> Bentley, WA, 6102
>
> PLEASE NOTE
> The information contained in this email may be confidential or
> privileged. Any unauthorised use or disclosure is prohibited. If
> you have received this email in error, please delete it immediately
> and notify the sender by return email. Thank you. To the extent
> permitted by law, CSIRO does not represent, warrant and/or
> guarantee that the integrity of this communication has been
> maintained or that the communication is free of errors, virus,
> interception or interference.
> Please consider the environment before printing this email.
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf
> Of Thomson Neil (EAST KENT HOSPITALS UNIVERSITY NHS FOUNDATION TRUST)
> Sent: Thursday, 7 April 2011 20:51
> To:
[hidden email]
> Subject: Normalising XY data by Z-direction in stacks
>
> Hi James
>
> I don't know your background, so forgive me if I'm way off the mark...
>
> This should be a pretty trivial problem with some coding. If you
> haven't looked at the developer<
http://rsbweb.nih.gov/ij/developer/
> index.html> section of he ImageJ website, have a look now. If
> you've never done any programming then writing a Java plugin might
> be a bit scary, but the macro language <
http://rsbweb.nih.gov/ij/
> developer/macro/macros.html> should so the trick.
>
> This macro-code snippet might give you an idea on normalisation:
>
> // Make sure image accepts floating point values
> run("32-bit");
> // get image width x
> // get image height y
> // get image depth z
> for (i=0; i < x; i++){
> for (j=0; i < y; j++){
> // Get max value in the x-y coord
> maxValue = 0;
> for (k=0; i < z; k++){
> setSlice(k);
> currValue = getPixel(x, y);
> if (currValue > maxValue){
> maxValue = currValue;
> }
> }
> // Set new value normalised to max value
> for (k=0; i < z; k++){
> setSlice(k);
> setValue(x, y, getPixel(x, y)/maxValue);
> }
> }
> }
>
> Neil
>
> Neil Thomson,
> Nuclear Medicine Physics Section,
> Medical Physics,
> Kent and Canterbury Hospital,
> UK. CT1 3NG
> +44 (0) 1227 766877
>
> **********************************************************************
> **********************************************
>
> This message may contain confidential information. If you are not
> the intended recipient please inform the
> sender that you have received the message in error before deleting it.
> Please do not disclose, copy or distribute information in this e-
> mail or take any action in reliance on its contents:
> to do so is strictly prohibited and may be unlawful.
>
> Thank you for your co-operation.
>
> NHSmail is the secure email and directory service available for all
> NHS staff in England and Scotland
> NHSmail is approved for exchanging patient data and other sensitive
> information with NHSmail and GSi recipients
> NHSmail provides an email address for your career in the NHS and
> can be accessed anywhere
> For more information and to find out how you can switch, visit
> www.connectingforhealth.nhs.uk/nhsmail
>
> **********************************************************************
> **********************************************