MATLAB Answers

How can I extract data from external software and save it as a data file?

5 views (last 30 days)
Naxhije Berisha
Naxhije Berisha on 24 Aug 2019
Commented: Naxhije Berisha on 26 Aug 2019
I am currently using imageJ to measure spherical nanoparticles. In that program, there's a way to automate batch processing of images to calculate various parameters. I'm interested in diameter but the software only calculates the area.
What I've been currently doing is copy pasting charts that are generated within ImageJ onto excel and then using one formula to get diameter from area. However, I'd really like to automate this since I work with a lot of images.
How can I extract the data from one program and save it as a data file? Once I have the code for that, it would be relatively easy to write code to import data and apply a formula.


dpb on 24 Aug 2019
That all depends on how the program generates its output -- most programs with a batch mode of processing will have some way in which can specify an output file. Or, if it outputs to the console, you can redirect that to a file if the program is well behaved and was coded with standard techniques.
But, we can't tell w/o knowing which particular program this is -- the documentation for it should answer the basic first question...once that's solved, doing something with those outputs should be essentially trivial.
dpb on 24 Aug 2019
But, reading doc at NIH I find--
"MIJ — Matlab–ImageJ bi-directional communicationA Java package for bi-directionaldata exchange between Matlab and ImageJ, allowing to exchange images between the twoimaging software. MIJ also allows MATLAB to access all built-in functions of ImageJas well as third-party ImageJ plugins. The developers provide more information on theMIJ and Matlab File Exchange websites. Fiji featuresMiji.m, which makes even moreconvenient to use the libraries and functions provided by Fiji’s components from within Matlab."
So, it may be even easier to interact than saving files just by driving the whole thing from Matlab.
But also see Section 22 on the Results Table that describes File>SaveAs and how to set file names. Undoubtedly all that can also be driven by the macro language
Naxhije Berisha
Naxhije Berisha on 26 Aug 2019
Thanks for both of your comments! I'll read more about MIJ for this particular script. I'm interested in generalizing a script if bidirectional communication isn't possible. But I'm not sure how I'd check the how the program generates output. I'm just starting with matlab and am inexperienced with that

Sign in to comment.

Answers (1)

Chidvi Modala
Chidvi Modala on 26 Aug 2019
ImageJ Datasets can be converted to the MATLAB supported NumericArray types using the ConvertService. These arrays can then be passed to a running MATLAB instance as a matrix. Appropriate formula can be applied on matrix.
You can make use of MIJ (MATLAB - ImageJ) which provides an extensible and bidirectional bridge for mutual exchange of data between these two environments.

  1 Comment

Naxhije Berisha
Naxhije Berisha on 26 Aug 2019
I didn't know about MIJ or bidirectional communication. I'll read up on it, thank you for the link!

Sign in to comment.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by