Hi everyone, I’m writing a short code to check for fluorescence beads
alignment. The strategy I’m considering is to generate the coordinates of the intensity distribution from a single bead in a cropped field of view across z axis. My code below is able to 1) shoot out coordinates for the xy plane and the 2) corresponding brightest pixel within the same plane but it’s unable to loop to the next slice. Can someone please help point out why this is the case? Any advice is much appreciated. Thanks. WJ getDimensions(width, height, channels, slices, frames); for (z=0; z<slices; z++) { for (x=0; x<width; x++) { for (y=0; y<height; y++){ X = Array.concat(X, x); Y = Array.concat(Y, y); Z = Array.concat(Z, z); Pix = Array.concat(Pix, getPixel(x,y)); } } } X1=Array.slice(X, 1, X.length); Y1=Array.slice(Y, 1, Y.length); Z1=Array.slice(Z, 1, Z.length); Pix1=Array.slice(Pix, 1, Pix.length); Array.getStatistics(Pix1, min, max, mean, stdDev); for (i=0; i<Pix1.length; i++) { if(Pix1[i] == max) { print(X1[i]+"_"+Y1[i]+"_"+Z1[i]); } } Array.show(X1, Y1, Z1, Pix1); -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
What about using Process > Find Maxima...?
To answer your question: setSlice(z); or Stack.setSlice(z); should work. Look at Stack (hyperstack) functions at https://imagej.nih.gov/ij/developer/macro/functions.html#S Cheers- Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY 10016 Office: 646-501-0567 Cell: 914-309-3270 [hidden email] http://nyulmc.org/micros http://microscopynotes.com/ -----Original Message----- From: wei.jian <[hidden email]> Sent: Tuesday, December 3, 2019 9:06 AM To: [hidden email] Subject: Extracting intensity values from each pixel in a z stack [EXTERNAL] Hi everyone, I’m writing a short code to check for fluorescence beads alignment. The strategy I’m considering is to generate the coordinates of the intensity distribution from a single bead in a cropped field of view across z axis. My code below is able to 1) shoot out coordinates for the xy plane and the 2) corresponding brightest pixel within the same plane but it’s unable to loop to the next slice. Can someone please help point out why this is the case? Any advice is much appreciated. Thanks. WJ getDimensions(width, height, channels, slices, frames); for (z=0; z<slices; z++) { for (x=0; x<width; x++) { for (y=0; y<height; y++){ X = Array.concat(X, x); Y = Array.concat(Y, y); Z = Array.concat(Z, z); Pix = Array.concat(Pix, getPixel(x,y)); } } } X1=Array.slice(X, 1, X.length); Y1=Array.slice(Y, 1, Y.length); Z1=Array.slice(Z, 1, Z.length); Pix1=Array.slice(Pix, 1, Pix.length); Array.getStatistics(Pix1, min, max, mean, stdDev); for (i=0; i<Pix1.length; i++) { if(Pix1[i] == max) { print(X1[i]+"_"+Y1[i]+"_"+Z1[i]); } } Array.show(X1, Y1, Z1, Pix1); -- Sent from: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.1557.x6.nabble.com_&d=DwIFaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=hUBj2D5n6oKThx2L01qn8IORZb5f-ruLVXPmQ1zQNnM&m=8aFERUaDSjwwNyYxWuKOTDw1utqwIU_Mbhlt2VL6tkA&s=6qdrtQOmi4s3gxLvUb44nOtDPHtD9vD25ritx2PA_rQ&e= -- ImageJ mailing list: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIFaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=hUBj2D5n6oKThx2L01qn8IORZb5f-ruLVXPmQ1zQNnM&m=8aFERUaDSjwwNyYxWuKOTDw1utqwIU_Mbhlt2VL6tkA&s=lEIUWc9_x2V8ibU-6J14xH-S7rAEz0sPYq-NGBSlltY&e= -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Michael,
Thanks for pointing that out. I got it working. Really appreciate your help. Adam -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |