ome / omero-scripts

Core OMERO Scripts
https://pypi.org/project/omero-scripts/
12 stars 32 forks source link

batch export ROI coordinates #147

Closed will-moore closed 5 years ago

will-moore commented 5 years ago

Noticed during the Dundee workshop - the Batch_ROI_Export script didn't include shape coordinates, lengths or areas. This adds them to the exported CSV, similar to export from iviewer: https://github.com/ome/omero-iviewer/pull/257

To test:

NB: We use the same pixel size units for the length and area of shapes from all images (since the column has a single unit in header). If some images have very different pixel size units from other images, we could get some very big or small numbers in the CSV, but we can probably assume they are similar if being exported together.

NB: The length and area are converted to length units (e.g. microns) but the shape coordinates are not. They are given in pixel coordinates, including e.g. the Rectangle Width and Height. This is the same behaviour as for iviewer ROI export. I think it makes sense and hope this will be understood by users.

pwalczysko commented 5 years ago

The resulting csv is still named "roi-intensities". Maybe "Batch ROI export" ?

pwalczysko commented 5 years ago

comparing an ellipse area between

I see two things

user-3 http://web-dev-merge.openmicroscopy.org/webclient/?show=image-70106

On the other hand, line and polyline shows a bit different behaviour (than the ellipse described above) - all differences can be explained by rounding errors.

pwalczysko commented 5 years ago

user-3 http://web-dev-merge.openmicroscopy.org/webclient/?show=image-162101

the order of ROIs in the CSV is different between iviewer and the script here. iviewer is taking the order of the ROIs from the ROI table, seems to me.

Batch ROI export is having its own ordering of ROIs, which I do not see at the moment the logic of.

pwalczysko commented 5 years ago

Tested up till now

Calibration

Some comments made

will-moore commented 5 years ago

Those commits fix the default name of the csv to Batch_ROI_Export.csv and sort the ROIs by ID (which I think is what iviewer is doing now). But, I don't see a difference in ordering for the image above user-3 http://web-dev-merge.openmicroscopy.org/webclient/?show=image-162101

Screen Shot 2019-04-18 at 11 08 34
pwalczysko commented 5 years ago

I think we should also revise the allocation of this script under "Export". Note: This script is not exporting ROIs. Unlike the Batch image export, which is exporting images.

I think this script belongs under Analysis.

pwalczysko commented 5 years ago

But, I don't see a difference in ordering for the image above user-3 http://web-dev-merge.openmicroscopy.org/webclient/?show=image-162101

Yes, I cannot repeat that myself now, but I guess it is good to have the ROIs sorted.

will-moore commented 5 years ago

The difference in Ellipse area between iviewer and Export script is an iviewer issue fixed in https://github.com/ome/omero-iviewer/pull/263

will-moore commented 5 years ago

I think this is still an "Export" script. Image export is different from downloading originals. It's exporting as" png etc. Here, we are exporting ROIs as* csv. Also, the script is called Batch_ROI_Export.py and the equivalent functionality in iviewer itself is ROIs > Export as Table.

To test last commits:

pwalczysko commented 5 years ago

I think this is still an "Export" script. Image export is different from downloading originals. It's exporting *as" png etc. Here, we are exporting ROIs as csv. Also, the script is called Batch_ROI_Export.py and the equivalent functionality in iviewer itself is ROIs > Export as Table.

Yes, understood, but these are all internal naming decisions. Camparison with other softwares shows that such functionality is always under Measure, Analyse etc. We are exporting values, measurements, coordinates. Saying that we are "exporting ROIs" is too much of a shortcut, and, more importantly, it does not ring a bell with what the user heard elsewhere IMHO

pwalczysko commented 5 years ago

testing on eel user-3

Ellipse: Image http://web-dev-merge.openmicroscopy.org/webclient/?show=image-21551 user-3

I probably do not understand the rounding - not sure how would I round the numbers to get from the script one to the iviewer one. They seem different to me. Also, still not clear why the decimanl places after the point should be so many in the script, so little in iviewer.

will-moore commented 5 years ago

For that image, I see a different Area in iviewer: 37.902 For script I see the same: 37.9016759387

Screen Shot 2019-04-23 at 13 38 21

I can round the Length and Area in the script to 3 decimal places...

pwalczysko commented 5 years ago

I can round the Length and Area in the script to 3 decimal places...

Actually, this is fine. Maybe lets better stick to the current status - more decimal places in the CSV seem a good idea to me, Excel can easily round it for you later.

yes, the image shows now the same elipse size in iviewer and script https://github.com/ome/scripts/pull/147#issuecomment-485787991

All good here