Dear all,
I'm using FIJI and would like to convert the pixel values between 0 and 25 to 30. I have created the following code but when the stack contains more than a certain number of slices it fails to cover the whole pixels. Could you please assist me with this problem? Is there a faster way available? This is the code: v1=0; v2=25; v3=30; O=getWidth(); Y=getWidth(); Z=getSliceNumber(); for (k = 1; k <= Z; k++){ for (i = 0; i <= O; i++){ for (j = 0; j <= Y; j++){ changeValues(v1, v2, v3); } } } Thank you very much. |
Hi fbhello (?),
you don't need the loops over the x and y coordinates: The 'changeValues' macro function works on the selection (if there is an area selection) or the full image otherwise. You do need the loop over the slices, but you have to select the slice before 'changeValues' see the setSlice function. http://rsb.info.nih.gov/ij/developer/macro/functions.html#setSlice Michael ________________________________________________________________ On Jun 25, 2015, at 13:57, fbhello wrote: > Dear all, > > I'm using FIJI and would like to convert the pixel values between 0 and 25 > to 30. I have created the following code but when the stack contains more > than a certain number of slices it fails to cover the whole pixels. Could > you please assist me with this problem? Is there a faster way available? > > This is the code: > > v1=0; > > v2=25; > > v3=30; > > O=getWidth(); > > Y=getWidth(); > > Z=getSliceNumber(); > > for (k = 1; k <= Z; k++){ > > for (i = 0; i <= O; i++){ > > for (j = 0; j <= Y; j++){ > > changeValues(v1, v2, v3); > > } > > } > > } > > > Thank you very much. > > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Changing-the-pixel-values-of-a-stack-tp5013284.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by fbhello
The fast method is to use Process/Math/Min, and set the value = 30.
cheers On 6/25/2015 6:57 AM, fbhello wrote: > Dear all, > > I'm using FIJI and would like to convert the pixel values between 0 and 25 > to 30. I have created the following code but when the stack contains more > than a certain number of slices it fails to cover the whole pixels. Could > you please assist me with this problem? Is there a faster way available? > > This is the code: > > v1=0; > > v2=25; > > v3=30; > > O=getWidth(); > > Y=getWidth(); > > Z=getSliceNumber(); > > for (k = 1; k <= Z; k++){ > > for (i = 0; i <= O; i++){ > > for (j = 0; j <= Y; j++){ > > changeValues(v1, v2, v3); > > } > > } > > } > > > Thank you very much. > > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Changing-the-pixel-values-of-a-stack-tp5013284.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- __ Vytas Bindokas, Ph.D. Research Assoc. (Assoc. Prof.), Director, BSD Light Microscopy Core Facility phone: 773-702-4875 [address for letters ONLY (see shipping addr below):] Dept Pharmacol Physiol Sci MC0926 947 E 58th Street The University of Chicago Chicago IL 60637 Room Abbott 129 shipping address (main KCBD site): V. Bindokas 900 E 57th Street KCBD room 1250, Microscopy Core The University of Chicago Chicago IL 60637 email [hidden email] web site for LMCF: http://digital.uchicago.edu/index.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |