Hardware Sensor Signal Import

Tags: #<Tag:0x00007fb879963a50> #<Tag:0x00007fb8799638c0>


How do you interface any hardware signal into ImageJ?
If you have for example a signal at returning a number that one wants to add to the log or results sheet or use in some calculations.


Typical you would use some kind of webapi. There are several powerful webapis available.

In Java (or using a scripting language) a simple example would be:


You can also use diverse Java libs for this.


The straightest forward seemed to use the core example. Setting the URL variable and then connection.getInputStream()
This should print the Temperature.

macro "Temperature" { 
import java.net.*;
import java.io.*;
URLConnection connection = new URL("").openConnection();
InputStream response = connection.getInputStream();

I get a Macro error “Undefined variable”.
Then I tried to include
import java.net.;
import java.io.
still Undefined variable
Try to change the language to JAVA gives me “java.lang.NullPointerException”
Then I searched for “running JAVA code from inside IJ1 macro language macro” in this forum and then on google.

I found:

There I read “using Java in the script editor is plagued with problems”
I read “There are two ways to add functions implemented as Java code” and then things get complicated.
I am still studying these references and all the links but if there is any another way that does not involve JAVA that would be much preferred.
I want to just say:

myURL= ""; 
TemperatureString = get.myURL…