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_AddImage(); Ext.Manager3D_SelectAll(); Ext.Manager3D_Rename("Nucleus"); Ext.Manager3D_Measure(); 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]"); Ext.Manager3D_CloseResult("M"); Ext.Manager3D_Reset();
To summarise, this is what I wish to achieve:
- 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.
- Compile multiple results tables that are outputted one by one from the 3D Manager into a single spreadsheet.
- 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)