Discussion:
FFT of color images
Greg Young
2012-01-31 19:31:54 UTC
Permalink
Dear List Members,

Apologies if this has already been dealt with on the list. I would appreciate getting directions to an explanation, or receiving one, of how Process > FFT handles color images. I have searched the list archives without sucess; I have reviewed the method's originals, by Arlo Reeves, and I see from ImageJ News that as of version 1.31u, Jan. 2003 that it can process color images. I have done so successfully, but need to know how: separate processing of RGB channels; conversion to HSI then FFT on I, etc?

Thanks very much.

Greg Young
Michael Schmid
2012-01-31 19:56:43 UTC
Permalink
Hi Greg,

you can find this in the sources of ij.process.FHT:
For non-float images, ImageJ does ip.convertToFloat().

Thus, for RGB images, it converts the image to grayscale, taking the color weights into account. See Edit>Options>Conversions and the macro command
setRGBWeights(redWeight, greenWeight, blueWeight.

If you want to separate the channels, either set the weights to e.g. (1,0,0) to get the FFT of the R channel or convert the RGB to a composite image, which has separate color channels.

Michael
________________________________________________________________
Post by Greg Young
Dear List Members,
Apologies if this has already been dealt with on the list. I would appreciate getting directions to an explanation, or receiving one, of how Process > FFT handles color images. I have searched the list archives without sucess; I have reviewed the method's originals, by Arlo Reeves, and I see from ImageJ News that as of version 1.31u, Jan. 2003 that it can process color images. I have done so successfully, but need to know how: separate processing of RGB channels; conversion to HSI then FFT on I, etc?
Thanks very much.
Greg Young
David M Gauntt
2012-01-31 21:53:11 UTC
Permalink
I am writing plugins using Eclipse under Windows XP SP3, and I have been
suffering from intermittent but frequent crashes of ImageJ. If anyone can
shed any light on how to work around this, I would love to hear from you.

According to the error log, the crash occurs in the AWT-Windows thread, in
native code at the following location:

C [awt.dll+0x3523a]
Java_sun_java2d_loops_TransformHelper_Transform+0x2571a

I have been able to reproduce this problem with a fresh download of
version 1.45s with none of my plugins added. To reproduce it, do the
following:

1) Open sample file AuPbSn 40
2) Apply command "Process/FFT/FFT"
2.5) (Optional) close both windows
3) Open sample file "Bridge".
4) Apply command "Process/FFT/FFT"
4.5) (Optional) close both windows
5) Open sample file "Fluorescent Cells".
6) Apply command "Process/FFT/FFT"
Crash.

This sequence causes a crash running a fresh download of version 1.45s
with none of my plugins added and running from Eclipse with my plugins and
version 1.46e. The order of the files does not seem to matter, and the
amount of memory available doesn't seem to matter (I've been able to
reproduce the crash with both 256M and 640M allocated for ImageJ).

The crash does not occur under OS X.

Under Eclipse, the console displays



#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d03523a, pid=10144,
tid=5164
#
# JRE version: 7.0_02-b13
# Java VM: Java HotSpot(TM) Client VM (22.0-b10 mixed mode, sharing
windows-x86 )
# Problematic frame:
# C [awt.dll+0x3523a]
#
# Failed to write core dump. Minidumps are not enabled by default on
client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

I have reported the problem to Sun, but before I worked out how to
reproduce it.


--
David M. Gauntt, Ph.D.
Associate Professor,
Division of Medical Physics and Engineering
UAB Department of Radiology

mailto:dmgauntt-***@public.gmane.org
205-975-3777
Johannes Schindelin
2012-02-01 07:54:56 UTC
Permalink
Hi David,
Post by David M Gauntt
C [awt.dll+0x3523a]
Java_sun_java2d_loops_TransformHelper_Transform+0x2571a
You might want to try to set the Java property sun.java2d.noddraw to true
and try again. (We had so many problems with that crash in Java2D when
running the Fiji distribution that we decided to make this setting the
default in Fiji's ImageJ launcher that is slated to be the default
launcher for ImageJ2.)

Ciao,
Johannes
Stephan Preibisch
2012-01-31 20:11:51 UTC
Permalink
Hi Greg,

in general I would do the preprocessing myself and always feed one single-channel image to any FFT routine at a time. Please also keep in mind that it is actually not a FFT ImageJ is doing, but a FHT ... it depends on why you are doing the Fourier transform if it makes a difference.

If you need real FFT's, I once wrote a small ImageJ plugin based on the 1d-FFT by Dave Hale: http://fly.mpi-cbg.de/~preibisch/software.html#FFT

Nice greetings,
Stephan
Post by Greg Young
Dear List Members,
Apologies if this has already been dealt with on the list. I would appreciate getting directions to an explanation, or receiving one, of how Process > FFT handles color images. I have searched the list archives without sucess; I have reviewed the method's originals, by Arlo Reeves, and I see from ImageJ News that as of version 1.31u, Jan. 2003 that it can process color images. I have done so successfully, but need to know how: separate processing of RGB channels; conversion to HSI then FFT on I, etc?
Thanks very much.
Greg Young
David M Gauntt
2012-02-01 15:14:59 UTC
Permalink
Thanks to Johannes Schindelin, my problem has been solve (or so it appears for now). Maybe now my hair will
start growing back.

For anyone else who might be struggling with this, to set the noddraw
property in Eclipse, do the following:

1) Right-click on your project in the "Package Explorer" pane, then select
"Build path / Configure build pathS"

2) In the left pane of the Properties window, select "Run/Debug settings".

3) Select your launch configuration, then click the "Edit" button.

4) Select the "Arguments" tab

5) In the VM Arguments field, add the text "-Dsun.java2d.noddraw=true"
without the quotes. Note that noddraw has two d's.

6) Hit "OK".

To set this option in the official Windows version of ImageJ:

1) Use Notepad to open the file ImageJ.cfg in the ImageJ directory.

2) Add the text "-Dsun.java2d.noddraw=true" without the quotes to the
beginning of the third line (or anywhere in the third line before ij.jar). For example,

.
jre\bin\javaw.exe
-Dsun.java2d.noddraw=true -Xmx512m -cp ij.jar ij.ImageJ



--
David M. Gauntt, Ph.D.
Associate Professor,
Division of Medical Physics and Engineering
UAB Department of Radiology

mailto:dmgauntt-***@public.gmane.org
205-975-3777







On 2/1/12 1:54 AM, "Johannes Schindelin" <Johannes.Schindelin-***@public.gmane.org<mailto:Johannes.Schindelin-***@public.gmane.org>>
wrote:

Hi David,

On Tue, 31 Jan 2012, David M Gauntt wrote:

C [awt.dll+0x3523a]
Java_sun_java2d_loops_TransformHelper_Transform+0x2571a

You might want to try to set the Java property sun.java2d.noddraw to true
and try again. (We had so many problems with that crash in Java2D when
running the Fiji distribution that we decided to make this setting the
default in Fiji's ImageJ launcher that is slated to be the default
launcher for ImageJ2.)

Ciao,
Johannes

Loading...