Automating Image Processing and Problems with FFTJ

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Automating Image Processing and Problems with FFTJ

Aaron Hendrickson
Hello,

I am doing some analysis on image sensor quality using the EMVA 1288
standard.  One of the tests I am conducting is referred to by the 1288
standard as "vertical and horizontal spectrograms".  In order to create the
horizontal spectrograms, I need to take a single image (32-bit grey tiff)
save each row of the image as a separate tiff file, and then generate a
32-bit Power Spectrum.  The same process is done to create vertical
spectrograms except the columns are used instead.

Since I do not have any Java experience, I have been using the macro
recorder in to record these steps and create a macro to do this on the fly.
 However, I am running into several problems.  First, I can't figure out
how to automate the cropping and saving of the rows and columns.  Here is a
the macro I recorded to create one row:

open("C:\\Users\\Owner\\Documents\\ATR\\cam_testing_images\\NAC_GX-1_monochrome_SerialNo.1200\\NAC_GX-1_mono_flat_images\\normal_gain_flats_8.22.11\\normal_gain_flats_originals\\3600us_4diffuser\\3600us_4diffuser_000009.tif");
makeRectangle(0, 0, 510, 1);
run("Crop");
saveAs("Tiff", "C:\\Users\\Owner\\Desktop\\rows\\00.tif");
close();

I then have to copy and paste this code a couple hundred times, change the
ROI, and increment the file name just to generate the rows or columns.
 Does anyone have any suggestions for how to automate this process such
that I can take an image of any resolution and automate the process of
saving all its rows and columns separately?

The next issue I am running into is generating and saving a 32-bit Power
Spectrum for each row and column image.  Again, I recorded the steps I took
to create a PS for one row image using FFTJ:

run("FFTJ ", "real=[00.tif] imaginary=<none> complex=[Double Precision]
fft=forward");
selectWindow("Power Spectrum With Origin At (0,0,0) (Double Precision)");

I again took the code and copied it many times while incrementing the image
name as to do this in a somewhat automated fashion.  When I did this I get
an error and IJ will not create even the first PS image because after FFTJ
is ran (first line of code) the user then has to click the show PS button
in FFTJ's GUI.  For whatever reason the macro recorder does not record me
clicking the "Show PS" button and therefore I cannot automate that either.

Therefore, my second question is how to automate creating the PS for each
row or column image using FFTJ.

I apologize for the long email and would greatly appreciate any help
someone could provide me.  It would save me an incredible amount of time
copying code and clicking buttons.

Respectfully,
Aaron

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

bnorthan
Hi Aaron

The first part of your question is relatively simple.  (Last year I
attended a good course at Havard by Lai Ding, (held twice a year I
think?)... he did a very good job of going over how to write loops in
Macros to process/create multiple images/files.)

Something like the code below should work... (note that I had to reopen the
original image each time through the loop... I suspect there could be a
more elegant way of doing it by somehow forcing crop to make a new image
each time).

open("/SomeDirectory/image.tif");
baseName="/SomeDirectory/profile";

height=getHeight();
width=getWidth();

for (h=0;h<height;h++)
{
    makeRectangle(0, h, width, 1);
    run("Crop");
    name=baseName+h+".tif";
    saveAs("Tiff", name);

    open("/SomeDirectory/image.tif");
    selectWindow("image.tif");
}

I believe the second part of your question requires some understanding of
java and imagej internals.   The source code is provided with the FFTJ
plugin so it is possible to take a look at it and modify it.  It looks like
the FFTJ plugin shows 2 dialogs.  The first one is an imagej
"GenericDialog", the second one is just a java "frame".

So what is the importance of that??  Basically the second dialog is not
implemented using the imagej framework... so the macro recorder doesn't
record interactions with it and won't skip showing it when running in a
script.

To get the behaviour you want you probably have to modify the source code.

The changes required aren't too complicated but you need a bit of java (you
would need to eliminate the code that shows the second dialog box and just
go directly to the code that creates and shows the power spectrum).

Brian



On Thu, Sep 5, 2013 at 7:45 AM, Aaron Hendrickson <[hidden email]> wrote:

> Hello,
>
> I am doing some analysis on image sensor quality using the EMVA 1288
> standard.  One of the tests I am conducting is referred to by the 1288
> standard as "vertical and horizontal spectrograms".  In order to create the
> horizontal spectrograms, I need to take a single image (32-bit grey tiff)
> save each row of the image as a separate tiff file, and then generate a
> 32-bit Power Spectrum.  The same process is done to create vertical
> spectrograms except the columns are used instead.
>
> Since I do not have any Java experience, I have been using the macro
> recorder in to record these steps and create a macro to do this on the fly.
>  However, I am running into several problems.  First, I can't figure out
> how to automate the cropping and saving of the rows and columns.  Here is a
> the macro I recorded to create one row:
>
>
> open("C:\\Users\\Owner\\Documents\\ATR\\cam_testing_images\\NAC_GX-1_monochrome_SerialNo.1200\\NAC_GX-1_mono_flat_images\\normal_gain_flats_8.22.11\\normal_gain_flats_originals\\3600us_4diffuser\\3600us_4diffuser_000009.tif");
> makeRectangle(0, 0, 510, 1);
> run("Crop");
> saveAs("Tiff", "C:\\Users\\Owner\\Desktop\\rows\\00.tif");
> close();
>
> I then have to copy and paste this code a couple hundred times, change the
> ROI, and increment the file name just to generate the rows or columns.
>  Does anyone have any suggestions for how to automate this process such
> that I can take an image of any resolution and automate the process of
> saving all its rows and columns separately?
>
> The next issue I am running into is generating and saving a 32-bit Power
> Spectrum for each row and column image.  Again, I recorded the steps I took
> to create a PS for one row image using FFTJ:
>
> run("FFTJ ", "real=[00.tif] imaginary=<none> complex=[Double Precision]
> fft=forward");
> selectWindow("Power Spectrum With Origin At (0,0,0) (Double Precision)");
>
> I again took the code and copied it many times while incrementing the image
> name as to do this in a somewhat automated fashion.  When I did this I get
> an error and IJ will not create even the first PS image because after FFTJ
> is ran (first line of code) the user then has to click the show PS button
> in FFTJ's GUI.  For whatever reason the macro recorder does not record me
> clicking the "Show PS" button and therefore I cannot automate that either.
>
> Therefore, my second question is how to automate creating the PS for each
> row or column image using FFTJ.
>
> I apologize for the long email and would greatly appreciate any help
> someone could provide me.  It would save me an incredible amount of time
> copying code and clicking buttons.
>
> Respectfully,
> Aaron
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

Herbie-3
In reply to this post by Aaron Hendrickson
Aaron,

as you've noticed, FFTJ isn't macro-scriptable.

So why not use the built-in ImageJ FFT that is fully macro-scriptable?
Don't forget to set and record the "FFT-Options..." before you call "FFT"!

BTW, I don't really understand how your images look like. Are these
one-dimensional images in the sense that their structure depends on one
coordinate only?

Best

Herbie

______________________________________________
On 05.09.13 13:45, Aaron Hendrickson wrote:

> Hello,
>
> I am doing some analysis on image sensor quality using the EMVA 1288
> standard.  One of the tests I am conducting is referred to by the 1288
> standard as "vertical and horizontal spectrograms".  In order to create the
> horizontal spectrograms, I need to take a single image (32-bit grey tiff)
> save each row of the image as a separate tiff file, and then generate a
> 32-bit Power Spectrum.  The same process is done to create vertical
> spectrograms except the columns are used instead.
>
> Since I do not have any Java experience, I have been using the macro
> recorder in to record these steps and create a macro to do this on the fly.
>   However, I am running into several problems.  First, I can't figure out
> how to automate the cropping and saving of the rows and columns.  Here is a
> the macro I recorded to create one row:
>
> open("C:\\Users\\Owner\\Documents\\ATR\\cam_testing_images\\NAC_GX-1_monochrome_SerialNo.1200\\NAC_GX-1_mono_flat_images\\normal_gain_flats_8.22.11\\normal_gain_flats_originals\\3600us_4diffuser\\3600us_4diffuser_000009.tif");
> makeRectangle(0, 0, 510, 1);
> run("Crop");
> saveAs("Tiff", "C:\\Users\\Owner\\Desktop\\rows\\00.tif");
> close();
>
> I then have to copy and paste this code a couple hundred times, change the
> ROI, and increment the file name just to generate the rows or columns.
>   Does anyone have any suggestions for how to automate this process such
> that I can take an image of any resolution and automate the process of
> saving all its rows and columns separately?
>
> The next issue I am running into is generating and saving a 32-bit Power
> Spectrum for each row and column image.  Again, I recorded the steps I took
> to create a PS for one row image using FFTJ:
>
> run("FFTJ ", "real=[00.tif] imaginary=<none> complex=[Double Precision]
> fft=forward");
> selectWindow("Power Spectrum With Origin At (0,0,0) (Double Precision)");
>
> I again took the code and copied it many times while incrementing the image
> name as to do this in a somewhat automated fashion.  When I did this I get
> an error and IJ will not create even the first PS image because after FFTJ
> is ran (first line of code) the user then has to click the show PS button
> in FFTJ's GUI.  For whatever reason the macro recorder does not record me
> clicking the "Show PS" button and therefore I cannot automate that either.
>
> Therefore, my second question is how to automate creating the PS for each
> row or column image using FFTJ.
>
> I apologize for the long email and would greatly appreciate any help
> someone could provide me.  It would save me an incredible amount of time
> copying code and clicking buttons.
>
> Respectfully,
> Aaron
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

Michael Schmid
In reply to this post by Aaron Hendrickson
On Sep 5, 2013, at 13:45, Aaron Hendrickson wrote:

> Therefore, my second question is how to automate creating the PS [power spectrum] for each row or column image using FFTJ.

You can get the Power Spectrum also from ImageJ: Process>FFT>FFT Options.
The 'native' ImageJ FFT functions should be fully macro-recordable.
Note that the values may be surprisingly large; if you don't like this divide by the square of the number of pixels to normalize.

BTW, if you want the average power spectrum of all rows or columns in your image, I guess that it is equivalent to average over the columns or rows of the power spectrum of the full image instead (I must admit that have not gone through the math to check whether this is strictly true).
ImageJ can average over columns by Image>Adjust>Size from e.g. 512x512 to 512x1, with 'average when downsizing' enabled and 'interpolation=none'.

Michael

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

Herbie-3
Dear Michael,

if we can assume that the Fourier-spectra of image projections are
desired, then they can be obtained by central slices through the spectra
of the images (central slice theorem).

For example:
The one-dimensional Fourier-transform of the vertical projection of an
image is the two-dimensional Fourier-transform of the image taken along
the f_x-axis.

Best

Herbie

__________________________________________
On 05.09.13 18:12, Michael Schmid wrote:

> On Sep 5, 2013, at 13:45, Aaron Hendrickson wrote:
>
>> Therefore, my second question is how to automate creating the PS [power spectrum] for each row or column image using FFTJ.
>
> You can get the Power Spectrum also from ImageJ: Process>FFT>FFT Options.
> The 'native' ImageJ FFT functions should be fully macro-recordable.
> Note that the values may be surprisingly large; if you don't like this divide by the square of the number of pixels to normalize.
>
> BTW, if you want the average power spectrum of all rows or columns in your image, I guess that it is equivalent to average over the columns or rows of the power spectrum of the full image instead (I must admit that have not gone through the math to check whether this is strictly true).
> ImageJ can average over columns by Image>Adjust>Size from e.g. 512x512 to 512x1, with 'average when downsizing' enabled and 'interpolation=none'.
>
> Michael
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

Aaron Hendrickson
Brian,

Thank you for the code and additional information; it was very useful to
know.

Herbie and Michael,

The reason I have been using FFTJ is because it returns a DFT in my case.
 The images I am using are originally 2-d images of double slit laser
interference patterns that are captured to evaluate  the MTF of the image
sensor under test.  I am aiming to measure the PS of each row or column
(depending on if test is MTF in vertical or horizontal direction) then
average them together and determine the frequency of the interference
pattern and its modulation.  If I remember correctly (which I might not)
when I made a PS from a single row image in ImageJ's FFT option, I got the
1-d PS displayed as a 2-D array.  Also, I know FFTJ returns a PS of the
same size as the original image and was not scaled in an way (which I
liked).  That is why I am trying to do this analysis through FFTJ and hence
the problem I had trying to record it.  That said, do you know of how the
source ode of FFTJ would have to be modified to do the batch processing I
need?

Respectfully,
Aaron

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

Herbie-3
Aaron,

I'm still not perfectly sure about the format of your images.

Are they really only one pixel wide or high (single pixel high row or
wide column)?
If so, I see no way to get the corresponding Fourier transform by using
FFTJ. Did you try this successfully? FFTJ requires that rows and columns
are greater than one!

If you have images on larger supports that only vary in one dimension
and are constant in the other, then FFTJ will do the job.

With respect to the image size and DFT versus FFT:
Why don't you pad your images? DFT is rather slow and using the next
larger square-sized power of two support most often will pay.

Best

Herbie

__________________________________________
On 05.09.13 23:29, Aaron Hendrickson wrote:

> Brian,
>
> Thank you for the code and additional information; it was very useful to
> know.
>
> Herbie and Michael,
>
> The reason I have been using FFTJ is because it returns a DFT in my case.
>   The images I am using are originally 2-d images of double slit laser
> interference patterns that are captured to evaluate  the MTF of the image
> sensor under test.  I am aiming to measure the PS of each row or column
> (depending on if test is MTF in vertical or horizontal direction) then
> average them together and determine the frequency of the interference
> pattern and its modulation.  If I remember correctly (which I might not)
> when I made a PS from a single row image in ImageJ's FFT option, I got the
> 1-d PS displayed as a 2-D array.  Also, I know FFTJ returns a PS of the
> same size as the original image and was not scaled in an way (which I
> liked).  That is why I am trying to do this analysis through FFTJ and hence
> the problem I had trying to record it.  That said, do you know of how the
> source ode of FFTJ would have to be modified to do the batch processing I
> need?
>
> Respectfully,
> Aaron
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

Aaron Hendrickson
Herbie,

Here is a screenshot showing a sample row of pixels taken from the original
2-d image (13.tif).  The row data is 32-bit grey tiff format and is only
one slice.  At the bottom of the screenshot is the PS generated by FFTJ
(Power Spectrum with origin at (0,0,0)).  Does that answer your question
about the format?

[image: Inline image 2]

Also, you said:

Why don't you pad your images? DFT is rather slow and using the next larger
> square-sized power of two support most often will pay.




Are you referring to padding with zero's?  For example, If I have an image
of dimensions 560x1 px I should add zeros's to the ends to make is 1024x1
px?  Sorry if thats a silly question ( I am still learning about FFT's).

Thanks,
Aaron.

On Thu, Sep 5, 2013 at 6:26 PM, Herbie <[hidden email]> wrote:

> Aaron,
>
> I'm still not perfectly sure about the format of your images.
>
> Are they really only one pixel wide or high (single pixel high row or wide
> column)?
> If so, I see no way to get the corresponding Fourier transform by using
> FFTJ. Did you try this successfully? FFTJ requires that rows and columns
> are greater than one!
>
> If you have images on larger supports that only vary in one dimension and
> are constant in the other, then FFTJ will do the job.
>
> With respect to the image size and DFT versus FFT:
> Why don't you pad your images? DFT is rather slow and using the next
> larger square-sized power of two support most often will pay.
>
> Best
>
> Herbie
>
> ______________________________**____________
>
> On 05.09.13 23:29, Aaron Hendrickson wrote:
>
>> Brian,
>>
>> Thank you for the code and additional information; it was very useful to
>> know.
>>
>> Herbie and Michael,
>>
>> The reason I have been using FFTJ is because it returns a DFT in my case.
>>   The images I am using are originally 2-d images of double slit laser
>> interference patterns that are captured to evaluate  the MTF of the image
>> sensor under test.  I am aiming to measure the PS of each row or column
>> (depending on if test is MTF in vertical or horizontal direction) then
>> average them together and determine the frequency of the interference
>> pattern and its modulation.  If I remember correctly (which I might not)
>> when I made a PS from a single row image in ImageJ's FFT option, I got the
>> 1-d PS displayed as a 2-D array.  Also, I know FFTJ returns a PS of the
>> same size as the original image and was not scaled in an way (which I
>> liked).  That is why I am trying to do this analysis through FFTJ and
>> hence
>> the problem I had trying to record it.  That said, do you know of how the
>> source ode of FFTJ would have to be modified to do the batch processing I
>> need?
>>
>> Respectfully,
>> Aaron
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>>
>>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

image format.jpg (448K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

Herbie-3
Aaron,

just very quickly:

It's interesting that FFTJ works with single lines for you. It doesn't
here on my Power-Mac, but perhaps I use an older version.

Padding should be on both sides and the value should be carefully chosen
to at least avoid abrupt signal changes. In any case the value should be
the same on both ends. In "real" 2D it is always good to imagine the
image on a torus and there should not be any abrupt signal changes
introduced by the padded values.

Have a good day

Herbie

_________________________________________
On 06.09.13 01:52, Aaron Hendrickson wrote:

> Herbie,
>
> Here is a screenshot showing a sample row of pixels taken from the original
> 2-d image (13.tif).  The row data is 32-bit grey tiff format and is only
> one slice.  At the bottom of the screenshot is the PS generated by FFTJ
> (Power Spectrum with origin at (0,0,0)).  Does that answer your question
> about the format?
>
> [image: Inline image 2]
>
> Also, you said:
>
> Why don't you pad your images? DFT is rather slow and using the next larger
>> square-sized power of two support most often will pay.
>
>
>
>
> Are you referring to padding with zero's?  For example, If I have an image
> of dimensions 560x1 px I should add zeros's to the ends to make is 1024x1
> px?  Sorry if thats a silly question ( I am still learning about FFT's).
>
> Thanks,
> Aaron.
>
> On Thu, Sep 5, 2013 at 6:26 PM, Herbie <[hidden email]> wrote:
>
>> Aaron,
>>
>> I'm still not perfectly sure about the format of your images.
>>
>> Are they really only one pixel wide or high (single pixel high row or wide
>> column)?
>> If so, I see no way to get the corresponding Fourier transform by using
>> FFTJ. Did you try this successfully? FFTJ requires that rows and columns
>> are greater than one!
>>
>> If you have images on larger supports that only vary in one dimension and
>> are constant in the other, then FFTJ will do the job.
>>
>> With respect to the image size and DFT versus FFT:
>> Why don't you pad your images? DFT is rather slow and using the next
>> larger square-sized power of two support most often will pay.
>>
>> Best
>>
>> Herbie
>>
>> ______________________________**____________
>>
>> On 05.09.13 23:29, Aaron Hendrickson wrote:
>>
>>> Brian,
>>>
>>> Thank you for the code and additional information; it was very useful to
>>> know.
>>>
>>> Herbie and Michael,
>>>
>>> The reason I have been using FFTJ is because it returns a DFT in my case.
>>>    The images I am using are originally 2-d images of double slit laser
>>> interference patterns that are captured to evaluate  the MTF of the image
>>> sensor under test.  I am aiming to measure the PS of each row or column
>>> (depending on if test is MTF in vertical or horizontal direction) then
>>> average them together and determine the frequency of the interference
>>> pattern and its modulation.  If I remember correctly (which I might not)
>>> when I made a PS from a single row image in ImageJ's FFT option, I got the
>>> 1-d PS displayed as a 2-D array.  Also, I know FFTJ returns a PS of the
>>> same size as the original image and was not scaled in an way (which I
>>> liked).  That is why I am trying to do this analysis through FFTJ and
>>> hence
>>> the problem I had trying to record it.  That said, do you know of how the
>>> source ode of FFTJ would have to be modified to do the batch processing I
>>> need?
>>>
>>> Respectfully,
>>> Aaron
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>>>
>>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

bnorthan
>
> That said, do you know of how the
>>>> source ode of FFTJ would have to be modified to do the batch processing
>>>> I
>>>> need?
>>>>
>>>
Aaron

One way to make the code macro recordable/callable is to make sure all gui
components (check boxes, options, etc.) are in a "GenericDialog".  If you
look at the FFTJ_.java file you can see several different types of dialog
boxes being used.  There is a "GenericDialog" as well as the
"DisclaimerWindow" and the "OutputFrame".  In the screen shot you attached,
the "DisclaimerWindow" and the "OutputFrame" can be seen.  These are a
problem because they are not implemented in a way that communicates with
the Macro framework.

So my approach to make it recordable is to not show "DisclaimerWindow" and
"OutputFrame" and place the options that were in the "OutputFrame" (Show
real part, show imaginary part, etc.) into the GenericDialog.

The changes are relatively simple so I put a "non-tested-example" on
GitHub.  If you look into the source code and compare FFTJ_.java to
FFTJ_Scriptable.java you can see the changes that were made.

https://github.com/bnorthan/RogueImageJPlugins/releases

I use Eclipse but one suggestion I've seen (if you are interested in making
changes to plugin java code) is to use Fiji and the *Plugins>Compile and
Run *option.  Easier to get started with I think.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

Aaron Hendrickson
Brian,

This will be very helpful!  I will take a look at it today and let you know
what happens.

Respectfully,
Aaron


On Mon, Sep 9, 2013 at 12:00 PM, Brian Northan <[hidden email]> wrote:

> >
> > That said, do you know of how the
> >>>> source ode of FFTJ would have to be modified to do the batch
> processing
> >>>> I
> >>>> need?
> >>>>
> >>>
> Aaron
>
> One way to make the code macro recordable/callable is to make sure all gui
> components (check boxes, options, etc.) are in a "GenericDialog".  If you
> look at the FFTJ_.java file you can see several different types of dialog
> boxes being used.  There is a "GenericDialog" as well as the
> "DisclaimerWindow" and the "OutputFrame".  In the screen shot you attached,
> the "DisclaimerWindow" and the "OutputFrame" can be seen.  These are a
> problem because they are not implemented in a way that communicates with
> the Macro framework.
>
> So my approach to make it recordable is to not show "DisclaimerWindow" and
> "OutputFrame" and place the options that were in the "OutputFrame" (Show
> real part, show imaginary part, etc.) into the GenericDialog.
>
> The changes are relatively simple so I put a "non-tested-example" on
> GitHub.  If you look into the source code and compare FFTJ_.java to
> FFTJ_Scriptable.java you can see the changes that were made.
>
> https://github.com/bnorthan/RogueImageJPlugins/releases
>
> I use Eclipse but one suggestion I've seen (if you are interested in making
> changes to plugin java code) is to use Fiji and the *Plugins>Compile and
> Run *option.  Easier to get started with I think.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

Aaron Hendrickson
Brian,

The modified FFTJ and accompanying macro worked very well!  I verified that
it was functional by running the macro on an entire image and then randomly
selected rows from the original image and processed them by hand.  Luckily,
I got the same numbers using both methods.  It was also pretty
straightforward to modify the macro to process columns.

One thing I wanted to ask you was a question regarding multiple output
directories.  When I run the macro, it creates and saves the individual
rows (or columns) plus its respective power spectrum.  Therefore, after the
macro is done running I open all the row image and PS image into a stack
and create a substack to separate them.   After that I save the row images
and PS's separately.  With this said here is my question:  Is it possible
to specify two output directories in the macro such that the row images and
PS's are saved to different folders?

Regardless if this can be done or not, I want to thank you for your help
with this macro.  It works great and has saved me a lot of time with my
work.

Cheers,
Aaron


On Tue, Sep 10, 2013 at 6:59 AM, Aaron Hendrickson <[hidden email]>wrote:

> Brian,
>
> This will be very helpful!  I will take a look at it today and let you
> know what happens.
>
> Respectfully,
> Aaron
>
>
> On Mon, Sep 9, 2013 at 12:00 PM, Brian Northan <[hidden email]> wrote:
>
>> >
>> > That said, do you know of how the
>> >>>> source ode of FFTJ would have to be modified to do the batch
>> processing
>> >>>> I
>> >>>> need?
>> >>>>
>> >>>
>> Aaron
>>
>> One way to make the code macro recordable/callable is to make sure all gui
>> components (check boxes, options, etc.) are in a "GenericDialog".  If you
>> look at the FFTJ_.java file you can see several different types of dialog
>> boxes being used.  There is a "GenericDialog" as well as the
>> "DisclaimerWindow" and the "OutputFrame".  In the screen shot you
>> attached,
>> the "DisclaimerWindow" and the "OutputFrame" can be seen.  These are a
>> problem because they are not implemented in a way that communicates with
>> the Macro framework.
>>
>> So my approach to make it recordable is to not show "DisclaimerWindow" and
>> "OutputFrame" and place the options that were in the "OutputFrame" (Show
>> real part, show imaginary part, etc.) into the GenericDialog.
>>
>> The changes are relatively simple so I put a "non-tested-example" on
>> GitHub.  If you look into the source code and compare FFTJ_.java to
>> FFTJ_Scriptable.java you can see the changes that were made.
>>
>> https://github.com/bnorthan/RogueImageJPlugins/releases
>>
>> I use Eclipse but one suggestion I've seen (if you are interested in
>> making
>> changes to plugin java code) is to use Fiji and the *Plugins>Compile and
>> Run *option.  Easier to get started with I think.
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

bnorthan
Hi Aaron

If I understand your question it should be simple.  Just point the saveAs
command wherever you want.  You can assign variables to different
directories...

directory1="/someDirectory/someLocation/"
directory2="/someDirectory/someOtherLocation/"

saveAs("format", directory1+someName);
(focus a different image)
saveAs("format", directory2+someName);

Saving your images where you want with the macro recorder running will also
produce the commands you need.  Then just put them in the loop.


On Wed, Sep 11, 2013 at 6:45 AM, Aaron Hendrickson <[hidden email]>wrote:

> Brian,
>
> The modified FFTJ and accompanying macro worked very well!  I verified that
> it was functional by running the macro on an entire image and then randomly
> selected rows from the original image and processed them by hand.  Luckily,
> I got the same numbers using both methods.  It was also pretty
> straightforward to modify the macro to process columns.
>
> One thing I wanted to ask you was a question regarding multiple output
> directories.  When I run the macro, it creates and saves the individual
> rows (or columns) plus its respective power spectrum.  Therefore, after the
> macro is done running I open all the row image and PS image into a stack
> and create a substack to separate them.   After that I save the row images
> and PS's separately.  With this said here is my question:  Is it possible
> to specify two output directories in the macro such that the row images and
> PS's are saved to different folders?
>
> Regardless if this can be done or not, I want to thank you for your help
> with this macro.  It works great and has saved me a lot of time with my
> work.
>
> Cheers,
> Aaron
>
>
> On Tue, Sep 10, 2013 at 6:59 AM, Aaron Hendrickson <[hidden email]
> >wrote:
>
> > Brian,
> >
> > This will be very helpful!  I will take a look at it today and let you
> > know what happens.
> >
> > Respectfully,
> > Aaron
> >
> >
> > On Mon, Sep 9, 2013 at 12:00 PM, Brian Northan <[hidden email]>
> wrote:
> >
> >> >
> >> > That said, do you know of how the
> >> >>>> source ode of FFTJ would have to be modified to do the batch
> >> processing
> >> >>>> I
> >> >>>> need?
> >> >>>>
> >> >>>
> >> Aaron
> >>
> >> One way to make the code macro recordable/callable is to make sure all
> gui
> >> components (check boxes, options, etc.) are in a "GenericDialog".  If
> you
> >> look at the FFTJ_.java file you can see several different types of
> dialog
> >> boxes being used.  There is a "GenericDialog" as well as the
> >> "DisclaimerWindow" and the "OutputFrame".  In the screen shot you
> >> attached,
> >> the "DisclaimerWindow" and the "OutputFrame" can be seen.  These are a
> >> problem because they are not implemented in a way that communicates with
> >> the Macro framework.
> >>
> >> So my approach to make it recordable is to not show "DisclaimerWindow"
> and
> >> "OutputFrame" and place the options that were in the "OutputFrame" (Show
> >> real part, show imaginary part, etc.) into the GenericDialog.
> >>
> >> The changes are relatively simple so I put a "non-tested-example" on
> >> GitHub.  If you look into the source code and compare FFTJ_.java to
> >> FFTJ_Scriptable.java you can see the changes that were made.
> >>
> >> https://github.com/bnorthan/RogueImageJPlugins/releases
> >>
> >> I use Eclipse but one suggestion I've seen (if you are interested in
> >> making
> >> changes to plugin java code) is to use Fiji and the *Plugins>Compile and
> >> Run *option.  Easier to get started with I think.
> >>
> >> --
> >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >>
> >
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Automating Image Processing and Problems with FFTJ

Aaron Hendrickson
Thank you Brian.  That is what I was asking.  I will add this to the macro
you sent.  Thanks again!


On Wed, Sep 11, 2013 at 8:59 AM, Brian Northan <[hidden email]> wrote:

> Hi Aaron
>
> If I understand your question it should be simple.  Just point the saveAs
> command wherever you want.  You can assign variables to different
> directories...
>
> directory1="/someDirectory/someLocation/"
> directory2="/someDirectory/someOtherLocation/"
>
> saveAs("format", directory1+someName);
> (focus a different image)
> saveAs("format", directory2+someName);
>
> Saving your images where you want with the macro recorder running will also
> produce the commands you need.  Then just put them in the loop.
>
>
> On Wed, Sep 11, 2013 at 6:45 AM, Aaron Hendrickson <[hidden email]
> >wrote:
>
> > Brian,
> >
> > The modified FFTJ and accompanying macro worked very well!  I verified
> that
> > it was functional by running the macro on an entire image and then
> randomly
> > selected rows from the original image and processed them by hand.
>  Luckily,
> > I got the same numbers using both methods.  It was also pretty
> > straightforward to modify the macro to process columns.
> >
> > One thing I wanted to ask you was a question regarding multiple output
> > directories.  When I run the macro, it creates and saves the individual
> > rows (or columns) plus its respective power spectrum.  Therefore, after
> the
> > macro is done running I open all the row image and PS image into a stack
> > and create a substack to separate them.   After that I save the row
> images
> > and PS's separately.  With this said here is my question:  Is it possible
> > to specify two output directories in the macro such that the row images
> and
> > PS's are saved to different folders?
> >
> > Regardless if this can be done or not, I want to thank you for your help
> > with this macro.  It works great and has saved me a lot of time with my
> > work.
> >
> > Cheers,
> > Aaron
> >
> >
> > On Tue, Sep 10, 2013 at 6:59 AM, Aaron Hendrickson <[hidden email]
> > >wrote:
> >
> > > Brian,
> > >
> > > This will be very helpful!  I will take a look at it today and let you
> > > know what happens.
> > >
> > > Respectfully,
> > > Aaron
> > >
> > >
> > > On Mon, Sep 9, 2013 at 12:00 PM, Brian Northan <[hidden email]>
> > wrote:
> > >
> > >> >
> > >> > That said, do you know of how the
> > >> >>>> source ode of FFTJ would have to be modified to do the batch
> > >> processing
> > >> >>>> I
> > >> >>>> need?
> > >> >>>>
> > >> >>>
> > >> Aaron
> > >>
> > >> One way to make the code macro recordable/callable is to make sure all
> > gui
> > >> components (check boxes, options, etc.) are in a "GenericDialog".  If
> > you
> > >> look at the FFTJ_.java file you can see several different types of
> > dialog
> > >> boxes being used.  There is a "GenericDialog" as well as the
> > >> "DisclaimerWindow" and the "OutputFrame".  In the screen shot you
> > >> attached,
> > >> the "DisclaimerWindow" and the "OutputFrame" can be seen.  These are a
> > >> problem because they are not implemented in a way that communicates
> with
> > >> the Macro framework.
> > >>
> > >> So my approach to make it recordable is to not show "DisclaimerWindow"
> > and
> > >> "OutputFrame" and place the options that were in the "OutputFrame"
> (Show
> > >> real part, show imaginary part, etc.) into the GenericDialog.
> > >>
> > >> The changes are relatively simple so I put a "non-tested-example" on
> > >> GitHub.  If you look into the source code and compare FFTJ_.java to
> > >> FFTJ_Scriptable.java you can see the changes that were made.
> > >>
> > >> https://github.com/bnorthan/RogueImageJPlugins/releases
> > >>
> > >> I use Eclipse but one suggestion I've seen (if you are interested in
> > >> making
> > >> changes to plugin java code) is to use Fiji and the *Plugins>Compile
> and
> > >> Run *option.  Easier to get started with I think.
> > >>
> > >> --
> > >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >>
> > >
> > >
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html