'Silent' client-side image processing with ImageJ

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

'Silent' client-side image processing with ImageJ

gj384
Hi there,

I'm in the process of developing an ImageJ macro with the following basic workflow:

1. Open TIFF file
2. Calculate NDVI (using Ned Horning's PhotoMonitoring plugin)
3. Apply a custom LUT to the NDVI image
4. Add a few other elements to the map (legend, scale bar, north arrow etc)
5. Save the new NDVI image as a new TIFF file

What I would really like to do is have the above process run 'silently' from a website - by this I mean the user would open the web page, log in etc, select a file from his local drives, fill in a few options and submit it for processing. The processing itself would take place on the client machine, and when it was complete the user would be presented with the final NDVI map which he could save and use.

Before I go too far down the path of doing this with a macro and then attempting to turn it into a 'silent' program as described above, I just thought I would ask if anyone else has done anything like this before, and whether it would even be possible. I tried a few different searches and couldn't find anything that seemed relevant to my question. I may be going about this in completely the wrong way, and in fact this is highly likely as I'm very new to both Java and ImageJ.

If anyone could provide any pointers or similar examples which might help I'd be extremely grateful!

Thanks in advance

Gareth Jones
Reply | Threaded
Open this post in threaded view
|

Re: 'Silent' client-side image processing with ImageJ

ctrueden
Hi Gareth,

What you want to do is more of a Javascript/web project. The ImageJ part
could certainly be done by running Fiji in headless mode on the server
side. But it is a non-trivial project because you have to integrate several
pieces together.

1) Get the ImageJ workflow working locally in headless mode.
http://imagej.net/Headless

2) Create a web page that behaves as you describe, triggering server-side
processing code that invokes ImageJ as a separate process, and waits for it
to complete. There are dozens of Javascript (and other language) web
frameworks to choose from.
http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks

You might also be interested in Volker Baecker's paper on a very similar
topic:

Baecker, V., and P. Travo. "Remote ImageJ-running macros on a distant
machine." *Proceedings of the ImageJ User and Developer Conference 2010*.

https://scholar.google.com/scholar?cluster=5003207782423199426&hl=en&as_sdt=0,50&sciodt=0,50

Regards,
Curtis

On Wed, May 20, 2015 at 10:21 PM, gj384 <[hidden email]> wrote:

> Hi there,
>
> I'm in the process of developing an ImageJ macro with the following basic
> workflow:
>
> 1. Open TIFF file
> 2. Calculate NDVI (using Ned Horning's PhotoMonitoring plugin)
> 3. Apply a custom LUT to the NDVI image
> 4. Add a few other elements to the map (legend, scale bar, north arrow etc)
> 5. Save the new NDVI image as a new TIFF file
>
> What I would really like to do is have the above process run 'silently'
> from
> a website - by this I mean the user would open the web page, log in etc,
> select a file from his local drives, fill in a few options and submit it
> for
> processing. The processing itself would take place on the client machine,
> and when it was complete the user would be presented with the final NDVI
> map
> which he could save and use.
>
> Before I go too far down the path of doing this with a macro and then
> attempting to turn it into a 'silent' program as described above, I just
> thought I would ask if anyone else has done anything like this before, and
> whether it would even be possible. I tried a few different searches and
> couldn't find anything that seemed relevant to my question. I may be going
> about this in completely the wrong way, and in fact this is highly likely
> as
> I'm very new to both Java and ImageJ.
>
> If anyone could provide any pointers or similar examples which might help
> I'd be extremely grateful!
>
> Thanks in advance
>
> Gareth Jones
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Silent-client-side-image-processing-with-ImageJ-tp5012894.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
Reply | Threaded
Open this post in threaded view
|

Re: 'Silent' client-side image processing with ImageJ

ctrueden
In reply to this post by gj384
Hi Gareth,

> The processing itself would take place on the client machine

I missed this point in my first response. That changes the equation. And I
don't have a good solution for you. But I would ask you to reevaluate
whether you really need to do things the way you describe, to accomplish
your goals. If you elaborate a bit more on what your requirements are,
perhaps people on the list can offer you more tractable solutions.

Regards,
Curtis

On Wed, May 20, 2015 at 10:21 PM, gj384 <[hidden email]> wrote:

> Hi there,
>
> I'm in the process of developing an ImageJ macro with the following basic
> workflow:
>
> 1. Open TIFF file
> 2. Calculate NDVI (using Ned Horning's PhotoMonitoring plugin)
> 3. Apply a custom LUT to the NDVI image
> 4. Add a few other elements to the map (legend, scale bar, north arrow etc)
> 5. Save the new NDVI image as a new TIFF file
>
> What I would really like to do is have the above process run 'silently'
> from
> a website - by this I mean the user would open the web page, log in etc,
> select a file from his local drives, fill in a few options and submit it
> for
> processing. The processing itself would take place on the client machine,
> and when it was complete the user would be presented with the final NDVI
> map
> which he could save and use.
>
> Before I go too far down the path of doing this with a macro and then
> attempting to turn it into a 'silent' program as described above, I just
> thought I would ask if anyone else has done anything like this before, and
> whether it would even be possible. I tried a few different searches and
> couldn't find anything that seemed relevant to my question. I may be going
> about this in completely the wrong way, and in fact this is highly likely
> as
> I'm very new to both Java and ImageJ.
>
> If anyone could provide any pointers or similar examples which might help
> I'd be extremely grateful!
>
> Thanks in advance
>
> Gareth Jones
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Silent-client-side-image-processing-with-ImageJ-tp5012894.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
Reply | Threaded
Open this post in threaded view
|

Re: 'Silent' client-side image processing with ImageJ

gj384
This post was updated on .
Hi Curtis,

Thanks so much for your advice. The reason I had hoped to do the processing
on the client side was due to the fact that our web host doesn't allow Java
applets on shared hosting (which we have) due to potential high CPU
requirements - we'll need to move to virtual private server or dedicated
server hosting to do that, which will cost us more than 10 times what we're
currently paying. Not completely out of the question though if that's the
only way we can make it work.

An alternative of course might be to package an ImageJ-based front end
desktop application that the user can download and install to carry out the
image processing on his own machine, but if it's possible to do it as a web
application then I believe that would be best as it would make it easier to
upgrade and improve the system in the future.

So here's a little more detail, in case it helps:

- The TIFF images we need to process are actually GeoTIFFs and comprise 3
bands - near-infrared, green and blue. I understand that ImageJ doesn't
currently handle GeoTIFF metadata (that is to say I can't find any plugins
that look like they can do it), and I'm experimenting with a few different
ways to copy the GeoTIFF metadata from the input image and apply it
post-processing to the output image, but that's not a pressing issue for
now.

- The processing involves a simple formula which creates a new single-band
TIFF in which each pixel is assigned a value from 0-255, representing a
real value of -1.0 to +1.0 (0 is -1.0, 128 is 0.0 and 255 is +1.0).
The -1.0 to +1.0 index value is a result of the formula (N-G)/(N+G). This
is a fairly widely used formula which can give an indication of crop health
and stress among other things - high values indicate healthy crops, low
values indicate unhealthy crops or very little crop biomass, and slight
negative values indicate water or snow. I've been using Ned Horning's
PhotoMonitoring plugin to do this via the GUI with very good results.

- I then apply a custom LUT which helps emphasise the variations across the
paddock, and categorise each zone into different range classes.

- Finally I'd like to automatically add a border, colour legend, scale bar,
North arrow etc - not up to this part yet though.

- The final output needs to be in TIFF format. Ideally I'd like to output
the maps in PDF format too but for now I'm just looking to get the basic
process working automatically for a group of web users without input from
my end each time an image is submitted for processing.

Thanks again. If anyone can give me any additional advice on getting this
to work through 'silent' client-side processing (i.e. without any of
the ImageJ GUI elements being displayed to the user at any time) I'd really
appreciate it. If this is simply not possible then that will also answer
many of my questions!

Cheers,
Gareth
Reply | Threaded
Open this post in threaded view
|

Re: 'Silent' client-side image processing with ImageJ

ctrueden
Hi Gareth,

Your easiest option from a development perspective is to create an ImageJ
update site, and direct your users to install ImageJ and activate your
update site. I.e.: a desktop application. It will be easy to push future
updates to your users that way.

If you are convinced a web app is necessary, then you can either:
A) do the processing on the server side, as I described earlier; or
B) use a Java applet to do the processing client side.

Those are the only ways (that I know of) you're going to be able to run
Java code as part of a web application. But running Java client-side is
becoming more and more difficult, due to the increasing stigma of Java
applets—e.g.,
http://www.javaworld.com/article/2078559/mobile-java/last-call-for-client-side-java.html

I guess a third option would be:
C) use Java Web Start to launch a Java desktop application from your web
page.
That would also make it easy to push updates. But it doesn't exactly give
you the "silent" processing you are looking for. Is that _really_ a
requirement though? If a little window popped up that told the user what
was going on as it was working, that would be fine, wouldn't it?

Regards,
Curtis

On Fri, May 22, 2015 at 11:11 PM, gj384 <[hidden email]> wrote:

> Hi Curtis,
>
> Thanks so much for your advice. The reason I had hoped to do the processing
> on the client side was due to the fact that our web host doesn't allow Java
> applets on shared hosting (which we have) due to potential high CPU
> requirements - we'll need to move to virtual private server or dedicated
> server hosting to do that, which will cost us more than 10 times what we're
> currently paying. Not completely out of the question though if that's the
> only way we can make it work.
>
> An alternative of course might be to package an ImageJ-based front end
> desktop application that the user can download and install to carry out the
> image processing on his own machine, but if it's possible to do it as a web
> application then I believe that would be best as it would make it easier to
> upgrade and improve the system in the future.
>
> So here's a little more detail, in case it helps:
>
> - The TIFF images we need to process are actually GeoTIFFs and comprise 3
> bands - near-infrared, green and blue. I understand that ImageJ doesn't
> currently handle GeoTIFF metadata (that is to say I can't find any plugins
> that look like they can do it), and I'm experimenting with a few different
> ways to copy the GeoTIFF metadata from the input image and apply it
> post-processing to the output image, but that's not a pressing issue for
> now.
>
> - The processing involves a simple formula which creates a new single-band
> TIFF in which each pixel is assigned a value from 0-255, representing a
> real value of -1.0 to +1.0 (0 is -1.0, 128 is 0.0 and 255 is +1.0).
> The -1.0 to +1.0 index value is a result of the formula (N-G)/(N+G). This
> is a fairly widely used formula which can give an indication of crop health
> and stress among other things - high values indicate healthy crops, low
> values indicate unhealthy crops or very little crop biomass, and slight
> negative values indicate water or snow. I've been using Ned Horning's
> PhotoMonitoring plugin to do this via the GUI with very good results.
>
> - I then apply a custom LUT which helps emphasise the variations across the
> paddock, and categorise each zone into different range classes.
>
> - Finally I'd like to automatically add a border, colour legend, scale bar,
> North arrow etc - not up to this part yet though.
>
> - The final output needs to be in TIFF format. Ideally I'd like to output
> the maps in PDF format too but for now I'm just looking to get the basic
> process working automatically for a group of web users without input from
> my end each time an image is submitted for processing.
>
> Thanks again. If anyone can give me any additional advice on getting this
> to work through 'silent' client-side processing (i.e. without any of
> the ImageJ GUI elements being displayed to the user at any time) I'd really
> appreciate it. If this is simply not possible then that will also answer
> many of my questions!
>
> Cheers,
> Gareth
>
> On Friday, May 22, 2015, ctrueden [via ImageJ] <
> [hidden email]> wrote:
>
> > Hi Gareth,
> >
> > > The processing itself would take place on the client machine
> >
> > I missed this point in my first response. That changes the equation. And
> I
> > don't have a good solution for you. But I would ask you to reevaluate
> > whether you really need to do things the way you describe, to accomplish
> > your goals. If you elaborate a bit more on what your requirements are,
> > perhaps people on the list can offer you more tractable solutions.
> >
> > Regards,
> > Curtis
> >
> > On Wed, May 20, 2015 at 10:21 PM, gj384 <[hidden email]
> > <http:///user/SendEmail.jtp?type=node&node=5012911&i=0>> wrote:
> >
> > > Hi there,
> > >
> > > I'm in the process of developing an ImageJ macro with the following
> > basic
> > > workflow:
> > >
> > > 1. Open TIFF file
> > > 2. Calculate NDVI (using Ned Horning's PhotoMonitoring plugin)
> > > 3. Apply a custom LUT to the NDVI image
> > > 4. Add a few other elements to the map (legend, scale bar, north arrow
> > etc)
> > > 5. Save the new NDVI image as a new TIFF file
> > >
> > > What I would really like to do is have the above process run 'silently'
> > > from
> > > a website - by this I mean the user would open the web page, log in
> etc,
> > > select a file from his local drives, fill in a few options and submit
> it
> > > for
> > > processing. The processing itself would take place on the client
> > machine,
> > > and when it was complete the user would be presented with the final
> NDVI
> > > map
> > > which he could save and use.
> > >
> > > Before I go too far down the path of doing this with a macro and then
> > > attempting to turn it into a 'silent' program as described above, I
> just
> > > thought I would ask if anyone else has done anything like this before,
> > and
> > > whether it would even be possible. I tried a few different searches and
> > > couldn't find anything that seemed relevant to my question. I may be
> > going
> > > about this in completely the wrong way, and in fact this is highly
> > likely
> > > as
> > > I'm very new to both Java and ImageJ.
> > >
> > > If anyone could provide any pointers or similar examples which might
> > help
> > > I'd be extremely grateful!
> > >
> > > Thanks in advance
> > >
> > > Gareth Jones
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://imagej.1557.x6.nabble.com/Silent-client-side-image-processing-with-ImageJ-tp5012894.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
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://imagej.1557.x6.nabble.com/Silent-client-side-image-processing-with-ImageJ-tp5012894p5012911.html
> >  To unsubscribe from 'Silent' client-side image processing with ImageJ,
> click
> > here
> > <
> >
> > .
> > NAML
> > <
>
http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
> --
>
> *Gareth Jones*
> *Precision Agriculture Consultant*
>
> *Eden Precision Agriculture*
>
> 0414 524 106
> [hidden email]
> edenpa.com.au
>
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Silent-client-side-image-processing-with-ImageJ-tp5012894p5012921.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
Reply | Threaded
Open this post in threaded view
|

Re: 'Silent' client-side image processing with ImageJ

gj384
Curtis, thanks so much for your advice.

I've been doing some more research on other options in terms of image processing, and I've come across a couple of Python-based techniques which look promising. I've also discovered that our host will allow execution of Python scripts on shared hosting, so this looks like it's going to be the best option for us in terms of cost too.

The plan at this point is to begin development of a Python-based image processing system, and then look at development of a separate customised Java-based desktop application, so that we can meet the needs of different types of users - those with good web access and plenty of data bandwidth to spare can use the online Python portal, while those who prefer to do the processing on their own machine and/or don't have reliable internet access can use the desktop Java application instead.

Thanks again, and let me know if you'd like me to keep you updated on our progress!

Cheers,
Gareth