Hi!
I am looking for a way to extract regions of equal degrees of blur from 16 bit TIF RGB images. Bart van der Wolf has kindly guided me to ImageJ in this thread on the Luminous-landscape.com forum: http://forum.luminous-landscape.com/index.php?topic=98885.msg808398#msg808398 providing this recipe: "to select defocused regions, you would need to use software that allows to isolate (de-)focused areas. This hints at spatial frequency separation, something that can e.g. be done with ImageJ with it's FFT Bandpass filter. Open the image and convert it to an "Image type 32-bit" version with the menu choices. Then use "Process FFT Bandpass Filter...", and use the setting from the attached image to select the focused areas. Then convert the result to "Image Type 16-bit" and save it as a TIFF or a PNG file, which then can be used in Photoshop to create a mask. You can create a mask from the above selection and a layer filled with 50% gray, in Difference mode. Then use a Levels adjustment and a bit of blur to get the general mask, perfected with some local painting in/out." The setting suggested for the FFT Bandpass filter was 'Filter large structure down to -1- pixels; filter small structures up to -0- pixels.' To extract regions of increasing blur, the first value would have to be increased, then the resulting masks would have to be subtracted. After some trial and error concerning 'out of memory' alerts, I am able to do the following: Open the image in ImageJ. It is displayed as 3 different layers, the red layer on top. Image > Color > Stack to RGB Process > FFT > Bandpass filter, with 2 different settings: 1-0 and 16-0. Image > Type > 16 bit In ImageJ, both of the resulting images look like the complete image, just in black and white. After saving to disk and then opening in Mac Preview or in PhotoLine, they both look all black. I am running ImageJ 1.49 64 bit on a MacBook Pro with OSX 10.9.5 and 16 GB of RAM. Can anybody help? - Thank you! Hening Bettermann. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
After some fiddling around, I have found out that even if I convert the stacked RGB to 8 bit grayscale before trying the Bandpass filter, I get the Out of Memory message. I had overlooked that, because the alert window is covered by any new image window which is created.
If I use 8bit gray images, and export as tifs, I get a grayscale image, not just black. But regardless which parameters I use, the resulting images are all the same. Meaning the Bandpass Filter operation is not performed at all, due to memory problems. So I think it is a problem of memory management, maybe specific for the Mac. When I get back home, I'll try it on Windows. So long. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Hening Bettermann
Hi Henning,
the following works for me: run("HeLa Cells (1.3M, 48-bit RGB)"); run("Stack to RGB"); run("Bandpass Filter...", "filter_large=16 filter_small=0 suppress=None tolerance=5"); run("16-bit"); Make sure that you have selected "automatic" 16-bit display range in Edit>Options>Appearance. Otherwise, a 16-bit image will appear black if it has low pixel values. I don't see a reason for using 16-bit resolution, however; RGB has only 8 bits, so 8 bits would give the same result. It would make sense to convert to 32 bits (floating point) *before* the Bandpass Filter is applied; just make sure you always use the same settings in Edit>Options>Conversions (if the color channels have roughly equal noise, 'weighted RGB conversions' should be off). Michael ________________________________________________________________ On Mar 25, 2015, at 18:08, Hening Bettermann wrote: > Hi! > > I am looking for a way to extract regions of equal degrees of blur from 16 bit TIF RGB images. Bart van der Wolf has kindly guided me to ImageJ in this thread on the Luminous-landscape.com forum: > http://forum.luminous-landscape.com/index.php?topic=98885.msg808398#msg808398 > > providing this recipe: > > "to select defocused regions, you would need to use software that allows to isolate (de-)focused areas. This hints at spatial frequency separation, something that can e.g. be done with ImageJ with it's FFT Bandpass filter. Open the image and convert it to an "Image type 32-bit" version with the menu choices. Then use "Process FFT Bandpass Filter...", and use the setting from the attached image to select the focused areas. Then convert the result to "Image Type 16-bit" and save it as a TIFF or a PNG file, which then can be used in Photoshop to create a mask. > > You can create a mask from the above selection and a layer filled with 50% gray, in Difference mode. Then use a Levels adjustment and a bit of blur to get the general mask, perfected with some local painting in/out." > > The setting suggested for the FFT Bandpass filter was 'Filter large structure down to -1- pixels; filter small structures up to -0- pixels.' > > To extract regions of increasing blur, the first value would have to be increased, then the resulting masks would have to be subtracted. > > After some trial and error concerning 'out of memory' alerts, I am able to do the following: > > Open the image in ImageJ. It is displayed as 3 different layers, the red layer on top. > Image > Color > Stack to RGB > Process > FFT > Bandpass filter, with 2 different settings: 1-0 and 16-0. > Image > Type > 16 bit > > In ImageJ, both of the resulting images look like the complete image, just in black and white. > > After saving to disk and then opening in Mac Preview or in PhotoLine, they both look all black. > > I am running ImageJ 1.49 64 bit on a MacBook Pro with OSX 10.9.5 and 16 GB of RAM. > > Can anybody help? - Thank you! > > Hening Bettermann. > > > > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
--- My latest message is AT BOTTOM! ---
On 27 Mar 2015, at 10:39h, Michael Schmid <[hidden email]> wrote: > Hi Henning, > > the following works for me: > > run("HeLa Cells (1.3M, 48-bit RGB)"); > run("Stack to RGB"); > run("Bandpass Filter...", "filter_large=16 filter_small=0 suppress=None tolerance=5"); > run("16-bit"); > > Make sure that you have selected "automatic" 16-bit display range in Edit>Options>Appearance. Otherwise, a 16-bit image will appear black if it has low pixel values. > I don't see a reason for using 16-bit resolution, however; RGB has only 8 bits, so 8 bits would give the same result. > It would make sense to convert to 32 bits (floating point) *before* the Bandpass Filter is applied; just make sure you always use the same settings in Edit>Options>Conversions (if the color channels have roughly equal noise, 'weighted RGB conversions' should be off). > > > Michael > _______ Hi Micheal, thank you for your reply! - My preferences (Edit > Options) are configured the way you describe. Yet, the 16 bit files look all black. - Where do I find the 'HeLa Cells' command? The Find-command did not find it anywhere in any menu in Help > Documentation. 'Run' may sound like it has to be run from the command line, but all the others are menu commands. Kind regards - Hening. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Michael Schmid
--- My latest message is AT BOTTOM! ---
On 27 Mar 2015, at 10:39h, Michael Schmid <[hidden email]> wrote: > Hi Henning, > > the following works for me: > > run("HeLa Cells (1.3M, 48-bit RGB)"); > run("Stack to RGB"); > run("Bandpass Filter...", "filter_large=16 filter_small=0 suppress=None tolerance=5"); > run("16-bit"); > > Make sure that you have selected "automatic" 16-bit display range in Edit>Options>Appearance. Otherwise, a 16-bit image will appear black if it has low pixel values. > I don't see a reason for using 16-bit resolution, however; RGB has only 8 bits, so 8 bits would give the same result. > It would make sense to convert to 32 bits (floating point) *before* the Bandpass Filter is applied; just make sure you always use the same settings in Edit>Options>Conversions (if the color channels have roughly equal noise, 'weighted RGB conversions' should be off). > > > Michael > _______ Hi Micheal, thank you for your reply! - My preferences (Edit > Options) are configured the way you describe. Yet, the 16 bit files look all black. - Where do I find the 'HeLa Cells' command? The Find-command did not find it anywhere in any menu in Help > Documentation. 'Run' may sound like it has to be run from the command line, but all the others are menu commands. Kind regards - Hening. Add-on: Unlike what I wrote in my first mail, I still get 'out of memory' alerts. I had overlooked them, since they are covered by new frames that open.- ImageJ 2.0 has just been released. Should I install that? -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
>>> On Mar 25, 2015, at 18:08, Hening Bettermann wrote:
>>> >>> Hi! >>> >>> I am looking for a way to extract regions of equal degrees of blur from 16 bit TIF RGB images... >>> >>> Process > FFT > Bandpass filter, with 2 different settings: 1-0 and 16-0. >>> >>> ... In ImageJ, both of the resulting images look like the complete image, just in black and white >> On 27 Mar 2015, at 10:39h, Michael Schmid wrote: >> >> Hi Henning, >> >> the following works for me: >> >> run("HeLa Cells (1.3M, 48-bit RGB)"); >> run("Stack to RGB"); >> run("Bandpass Filter...", "filter_large=16 filter_small=0 suppress=None tolerance=5"); >> run("16-bit"); >> >> Make sure that you have selected "automatic" 16-bit display range in Edit>Options>Appearance. Otherwise, a 16-bit image will appear black if it has low pixel values. >> I don't see a reason for using 16-bit resolution, however; RGB has only 8 bits, so 8 bits would give the same result. >> It would make sense to convert to 32 bits (floating point) *before* the Bandpass Filter is applied; just make sure you always use the same settings in Edit>Options>Conversions (if the color channels have roughly equal noise, 'weighted RGB conversions' should be off). >> >> >> Michael > On Mar 27, 2015, at 17:33, Hening Bettermann wrote: > -------------------------------------------------- > Hi Micheal, > thank you for your reply! - > My preferences (Edit > Options) are configured the way you describe. Yet, the 16 bit files look all black. - > Where do I find the 'HeLa Cells' command? The Find-command did not find it anywhere in any menu in Help > Documentation. 'Run' may sound like it has to be run from the command line, but all the others are menu commands. > Kind regards - Hening. > > Add-on: > Unlike what I wrote in my first mail, I still get 'out of memory' alerts. I had overlooked them, since they are covered by new frames that open.- > ImageJ 2.0 has just been released. Should I install that? Hi Henning, "HeLa Cells" is in the "Open Samples" directory, just to have a test image. If you get an 'out of memory' error, maybe you have a large virtual stack? After processing the images, they must be all in memory. In that case, open the stack slices one by one and save the results into a separate directory. But I noticed now that the Bandpass Filter does not work as expected for the RGB images; you should convert from RGB to 32 bits before running the Bandpass Filter. Also the analysis steps following the Bandpass for that purpose would be best done with 32 bits (background subtraction, taking the absolute value, some blurring). Then select a reasonable grayscale range and convert to 16 bit (Edit>Options>Scale when converting should be on). --- If 16-bit images look black in a program different than ImageJ, it might indicate that (a) that program does not read them correctly or (b) that program scales 0-65535 to black-white, but the pixel values are much smaller (e.g. 0-255), so they all appear black. I am using ImageJ 1.49p. I don't know much about ImageJ 2, but I don't think it would be better. Michael -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
--- My latest message is AT BOTTOM! ---
On 27 Mar 2015, at 17:59h, Michael Schmid <[hidden email]> wrote: >>>> On Mar 25, 2015, at 18:08, Hening Bettermann wrote: >>>> >>>> Hi! >>>> >>>> I am looking for a way to extract regions of equal degrees of blur from 16 bit TIF RGB images... >>>> >>>> Process > FFT > Bandpass filter, with 2 different settings: 1-0 and 16-0. >>>> >>>> ... In ImageJ, both of the resulting images look like the complete image, just in black and white > >>> On 27 Mar 2015, at 10:39h, Michael Schmid wrote: >>> >>> Hi Henning, >>> >>> the following works for me: >>> >>> run("HeLa Cells (1.3M, 48-bit RGB)"); >>> run("Stack to RGB"); >>> run("Bandpass Filter...", "filter_large=16 filter_small=0 suppress=None tolerance=5"); >>> run("16-bit"); >>> >>> Make sure that you have selected "automatic" 16-bit display range in Edit>Options>Appearance. Otherwise, a 16-bit image will appear black if it has low pixel values. >>> I don't see a reason for using 16-bit resolution, however; RGB has only 8 bits, so 8 bits would give the same result. >>> It would make sense to convert to 32 bits (floating point) *before* the Bandpass Filter is applied; just make sure you always use the same settings in Edit>Options>Conversions (if the color channels have roughly equal noise, 'weighted RGB conversions' should be off). >>> >>> >>> Michael > >> On Mar 27, 2015, at 17:33, Hening Bettermann wrote: >> -------------------------------------------------- >> Hi Micheal, >> thank you for your reply! - >> My preferences (Edit > Options) are configured the way you describe. Yet, the 16 bit files look all black. - >> Where do I find the 'HeLa Cells' command? The Find-command did not find it anywhere in any menu in Help > Documentation. 'Run' may sound like it has to be run from the command line, but all the others are menu commands. >> Kind regards - Hening. >> >> Add-on: >> Unlike what I wrote in my first mail, I still get 'out of memory' alerts. I had overlooked them, since they are covered by new frames that open.- >> ImageJ 2.0 has just been released. Should I install that? > > Hi Henning, > > "HeLa Cells" is in the "Open Samples" directory, just to have a test image. > If you get an 'out of memory' error, maybe you have a large virtual stack? After processing the images, they must be all in memory. In that case, open the stack slices one by one and save the results into a separate directory. > > But I noticed now that the Bandpass Filter does not work as expected for the RGB images; you should convert from RGB to 32 bits before running the Bandpass Filter. Also the analysis steps following the Bandpass for that purpose would be best done with 32 bits (background subtraction, taking the absolute value, some blurring). Then select a reasonable grayscale range and convert to 16 bit (Edit>Options>Scale when converting should be on). > > --- > If 16-bit images look black in a program different than ImageJ, it might indicate that (a) that program does not read them correctly or (b) that program scales 0-65535 to black-white, but the pixel values are much smaller (e.g. 0-255), so they all appear black. > > I am using ImageJ 1.49p. I don't know much about ImageJ 2, but I don't think it would be better. > > Michael > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html Hi Micheal, thank you for your reply. I have in the meantime tried to read some of the documentation, but without being able to extract much of use for my purpose. Strange enough, if I first convert to RGB stack (Image > Color > Stack to RGB), then convert to 32 bit grayscale (Image > Type > 32 bit), then export as TIF and open that in Preview, I see an inverted image, not just black. Regardless, trying to run Process > FFT > Bandpass Filter, still gives me the memory error. - Which operating system and version do you use? How much RAM do you have/allocated to ImageJ? Mine is Mac 10.9.5, and I have 16 GB of RAM, 12 allocated to ImageJ. Kind regards - Hening. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Fri, March 27, 2015 23:44, Hening Bettermann wrote:
> > I have in the meantime tried to read some of the documentation, but > without being able to extract much of use for my purpose. > Strange enough, if I first convert to RGB stack (Image > Color > Stack to > RGB), then convert to 32 bit grayscale (Image > Type > 32 bit), then > export as TIF and open that in Preview, I see an inverted image, not just > black. > Regardless, trying to run Process > FFT > Bandpass Filter, still gives me > the memory error. - Which operating system and version do you use? How > much RAM do you have/allocated to ImageJ? > Mine is Mac 10.9.5, and I have 16 GB of RAM, 12 allocated to ImageJ. > Hi Henning, (1) There is hardly any software apart from ImageJ that can read 32-bit TIFFs (Preview on OS X 10.6 can't, but it does not complain that it can't read it). For exporting, you have to convert to 8 or 16 bits (make sure that the display range in Adjust Brightness&Contrast is reasonable and 'Scale when converting' is checked in Options>Conversions). All tiff readers can handle 8 bits, a few programs can also handle 16 bits. Preview on OS X 10.6 can read 16-bit tiffs, but many 16-bit TIFFs appear black or almost black in Preview because it assumes that the grayscale range from black to white is 0-65535, i.e., all 16 bits are used. Many 16-bit tiffs don't actually use the full dynamic range possible with 16 bits. (2) I have never seen a memory error with Bandpass Filter, using Macs with mostly OSX 10.5 or 10.6, Java 1.6. 2-8 GB of RAM, and 640 MB-2 GB limit for ImageJ. Typically, I have rather small images, however. For 4096x4096 pixels, about 1 GB is needed. Michael -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Hening Bettermann
I have received this answer from Wayne Rasband. I see that my answer has only gone to him himself, not to the list. So I send it here.
HB. > Dear Hening, > > You should not be running out of memory unless you working with an extremely large image. Please make an example available so we can try to reproduce the problems you are having. > > Best regards, > > -wayne Hi Wayne, thank you for chiming in! I have just uploaded a TIF to my FTP server. The image is an exposure stack of 3 frames, 126,5 MB. The file name is 'RobinieLuma'. The server name: landshape.net ; user name: [hidden email] ; password: come_in . That would be great if you could solve this! Best regards - Hening. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |