Using Read and Write Excel with 3D Manager Results

Hi everyone!

Firstly, this forum has really helped me get to grips with macros and segmentation, so thank you to those who so generously give their time!

My problem appears to be simple, but I cannot for the life of me figure it out - any advice is greatly appreciated.

I have a macro that utilises CLIJ (thanks @haesleinhuepf), the 3D ImageJ Suite (thanks @ThomasBoudier) and MorpholibJ (thanks @dlegland) to segment some cells and perform some measurements. The pipeline then uses these ROIs to quantify fluorescent intensity in selected areas of different channels within the original image. The complete macro works as it is; however, I have not been able to implement some additional functionality that would save me a lot of time. I have noticed that .csv files generated by the 3D Manager are not delimited in the same way as standard ImageJ results tables, and thus, Excel doesn’t want to recognise the different columns. To resolve this, I have been converting text to columns by adjusting the delimiting variable to “tabs” rather than commas. While this resolves my issue, it’s very manual and, with many results tables, time-consuming. I have also tried saving these files as .xlsx instead of .csv as below, however these appear to be broken and I cannot open them. Moreover, I generate eight tables per dataset, so it would be useful to compile these results into a single output spreadsheet that is excel-compatible without the need for modifying the delimiter, which, as far as I can tell, cannot be changed by default.

While I was looking for ways to do this, I encountered @antinos Read and Write Excel plugin. This seems to address my desire to compile results tables; however, I cannot get any sensible outputs while working with the 3D Manager results tables in my macro. Please see attached. I am unsure if the Read and Write Excel Plugin has issues with the format of the 3D Manager Results tables as well or if I have missed another important step (very likely!).

While testing, I am running both the 3D Manger’s SaveResult and the Read and Write Excel save – I have been getting the same results regardless; their order does not make a difference either.

A simple example from my code is below.
After segmentation, and setting the options for the 3D manager I perform the following:

// Open the manager, add the segmented nuclei, measure, save results and then empty the manager
run("3D Manager");
selectWindow("Segmented Nuclei.tif");
Ext.Manager3D_SaveResult("M", "C:/Users/21716603/Desktop/DataOutput/Nuclei Measurements.csv");
run("Read and Write Excel", "file=[C:/Users/21716603/Desktop/DataOutput/Results.xlsx] dataset_label=[Nuclei Measurements]");

To summarise, this is what I wish to achieve:

  1. Generate a normal ImageJ results table (one that saves with Excel-compatible delimiters) from a 3D Manager Results table. Is there a way to export from the 3D Manager results to the normal ImageJ results table and save from there? As I do not have the same delimiter issue from a standard results table.
  2. Compile multiple results tables that are outputted one by one from the 3D Manager into a single spreadsheet.

Additional considerations:

  1. I have tried to save the 3D Manager results tables with output variables (such as a user-defined OutputDir) but have been unable to get this working. Is this possible? I have tried alternative syntax such as [“ + OutputDir + “] as well without any success. This works with the Read and Write Excel plugin, but I could not find a way to get this working with the 3D Manger’s SaveResults command.

Please find the .tif of segmented nuclei, results output from the Read and Write Excel plugin (.png image as .xlsx file wouldn’t upload and the measurement outputs from the 3D Manager attached. The two results outputs are generated with this portion of my code to help you understand my problem.

Thank you so much for your help in advance!

M_Nuclei_Measurements.csv (46.7 KB)

Segmented Nuclei.tif (7.6 MB)

Hi @SebastianAmos,

I’m very glad to try to help you. I’m a little busy today so will only get a chance to properly look into this this evening. On an off-chance, is the 3D Manager results table named ‘Results’?
If not, could you add a macro line to rename the table to ‘Results’, and see if that solves your issue.

Kind regards.

1 Like

Hey @SebastianAmos ,

just a quick idea: Instead of 3D Manager measurements, could you also use MorphoLibJs measurements? As far as I know, they come as ImageJ Results tables.

Let us know if this helps!



Thanks for your suggestions guys - much appreciated!

@antinos the 3D Manger outputs are named “3D Measure” or “3D Quantif”, respectively. I have tried to rename these result outputs without any success. As these do not appear to be “normal” results tables; there is no option to rename in an interactive fashion. When I tried to script this process using both rename() and Table.rename() I was given the errors attached below. I have also tried selecting the window with both “3D Measure” and “3D_Measure” - with the same errors.
Any other ideas on how to rename these 3D Manager outputs?

@haesleinhuepf I have also tried utilising the MorphoLibJ Analyze Regions 3D and Intensity Measurements 2D/3D and when I rename these output files to “Results” with Table.rename() the Read and Write Excel plugin works perfectly!! Thank you!

So there definitely appears to be something funny with the 3D Manager tables.
Any other ideas on how to rename these to “Results” or ideally collect that data and export it to a normal ImageJ results table? I feel like the latter would resolve all of my problems!

Thanks again for your input.



@haesleinhuepf @antinos @dlegland Having said that… I’ve now run into another issue that I’m hoping is just me missing something obvious!
The code for measuring my segmentation works perfectly with the Read and Write Excel plugin, but I’m having issues with the Intensity Measurements input.
I have:

run("Intensity Measurements 2D/3D", "input=C2-" + ImageName + "labels=" + WholeSpheroid + " mean stddev max min median mode numberofvoxels volume");
Table.rename("C2-" + ImageName + "-intensity-measurements", "Results");
run("Read and Write Excel", "file_mode=queue_write dataset_label=[Paxillin Quantification]");

When executing, the “ImageName” does not appear to be used properly as the input and yet, when I checked this with Print() the variable is correct.
Any ideas as to why the image’s name isn’t being used correctly here?
I’ve searched for obvious concatenation or syntax errors, but as far as I can tell what I have should be correct. I have also tried wait() for a few seconds, without any success.

Any advice would be awesome!

1 Like

Hey @SebastianAmos ,

ImageJ is not so happy with spaces in parameter values such as image names. You can easily circumvent that by putting [] around:

run("Intensity Measurements 2D/3D", "input=[C2-" + ImageName + "] labels=[" + WholeSpheroid + "] mean stddev max min median mode numberofvoxels volume");

Let us know if this helps!


1 Like

Hey @haesleinhuepf
Thanks for the quick response!
I added some square brackets as suggested and while the ImageName is now perfect (yay!) but the MorpholibJ plugin still doesn’t want to accept that input (No!).

I ran the analysis I want to perform with a macro recorder and this is what ImageJ wants to do:

run("Intensity Measurements 2D/3D", "input=C2-SUIT2_A3002_1_Cropped labels=WholeSpheroid mean stddev max min median mode numberofvoxels volume");

I thought that perhaps the file suffix on the end was causing the error, so I tried creating new file names without the .tif, but that produced the same error:

QuantifImage = substring(ImageName, 0, lengthOf(ImageName)-4);
QuantifSpheroid = substring(WholeSpheroid, 0, lengthOf(WholeSpheroid)-4);
run("Intensity Measurements 2D/3D", "input=[C2-" + QuantifImage + "] labels=[" + QuantifSpheroid + "] mean stddev max min median mode numberofvoxels volume");


So, perhaps my question is now around what constitutes a “valid choice for input” when using Intensity Measurements 2D/3D - any ideas?

I really appreciate your help!

Hi @SebastianAmos ,

Yes the 3D Manager creates non-standard Image Results Tables, because I wanted more control over the results. However, the format .csv in which they are saved are clearly Excel compatible. Usually I save the 3D Manager results table, and then open them with ImageJ, so you will get a ImageJ Results Table.

Regarding the possibility to merge results table, this is done within another project TAPAS.

Hope this helps



1 Like

Thanks for the reply @ThomasBoudier,
That makes sense - I never even thought of re-opening them in ImageJ and then saving from there, thanks for the tip!