Repository navigation
Pixel Sizes - #3045
Pixel Sizes#3045
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3045 +/- ##
=======================================
Coverage 62.84% 62.84%
=======================================
Files 530 531 +1
Lines 64042 64118 +76
=======================================
+ Hits 40245 40297 +52
- Misses 23797 23821 +24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
btbest
left a comment
There was a problem hiding this comment.
Awesome to finally see pixel size metadata in ilastik 🥳
A few minor things from my side, mostly nitpicks. And I'm excited to see your draft work using the new metadata once it's rebased ;)
There was a problem hiding this comment.
Hello @Peter-Laszcz - really solid work! Nicely tested, too. I had a few comments - some of them are taste :). @btbest, maybe you want to weigh in on those. Really critical for me right now is documenting the changes to the zipped projects (as this is hard to follow otherwise), and maybe the default dictionary value in DatasetInfo.
Another thought experiment: Say I export a subregion - one of the axes becomes singleton and I chose to drop it, would the metadata reflect this accurately in all file formats?
Just tried it and came up with an interesting result. Ilastik exports the correct pixel sizes to the correct areas in the metadata, but FIJI can't read it properly:
Checking with tifffile, these fields appear to have the correct numbers and format. One thing I did notice - not sure if it's any bearing on what's going on here- was that Ilastik seems to have added in a channel axis which has shifted the image data along one axis, i.e. the image was meant to have an XY axis set and shape of (16,16) but has been exported with an axis set of CYX and a shape of (16,16,2), also producing the unfortunate side effect of the X axis being listed as having a length of 2 in the metadata :/ |
|
To update on the issue I came across- it was actually the manifestation of three separate problems:
|
|
Hello! After tidying up the commits, I think this PR is ready for another review :)
As per last week's meeting, I've removed all the functionality for exporting pixel sizes via opExport2DImage ("tiff" in export format), to potentially be replaced by a specialised format in the future. Note, however, that one should still be able to obtain 2D TIFFs with pixel sizes via opExportMultipageTiff ("multipage tiff" in export format), so until then there's a good workaround. |
There was a problem hiding this comment.
Wow that is some clean git history :) Must have been a fun rebase. Thank you for going through that!
Really solid work with exemplary test coverage.
On the danger of being incredibly annoying I found a case that I would expect to work, not working:
Exporting to hdf5 (probabilities from pixel classification) (very cool with units now) and loading this data as raw data seems to fail if the input has no channel axes (then, no unit gets written, but ui seems to expect it to be there for all the axes):
traceback
ERROR 2025-09-16 16:05:57,750 excepthooks 46725 8611815616 Traceback (most recent call last):
File "...ilastik/ilastik/applets/dataSelection/datasetDetailedInfoTableModel.py", line 145, in data
return self._getDisplayRoleData(index)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...ilastik/ilastik/applets/dataSelection/dataLaneSummaryTableModel.py", line 75, in _getDisplayRoleData
return model_cls._getDisplayRoleData(self, index)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...ilastik/ilastik/applets/dataSelection/datasetDetailedInfoTableModel.py", line 232, in _getDisplayRoleData
axis_strings = [
^
File "...ilastik/ilastik/applets/dataSelection/datasetDetailedInfoTableModel.py", line 242, in <listcomp>
if tag.resolution or datasetInfo.axis_units[tag.key]
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'c'
example data: blobs.zip
This happened because I was allowing channel axes to display pixel sizes, because there is a niche case where someone could potentially write a unit to the channel axis in the h5 format. However, after some thought, the commit I am pushing to fix this will stop channel pixel sizes from appearing in the data table, mainly as anything written in that field would not be used/manipulable in ilastik in any way I can fathom (however, the data is still passed through the pipeline so if a use case emerges it's somewhat futureproof) |
|
I probably wouldn't mind showing the unit value for the c axis if it's there, but let's leave it as is. For the circleCI failure you probably need to merge main into this PR again (vaguely remember running into this and fixing it). Also cool the added units for the ome export - would you say this is more or less complete now @Peter-Laszcz? |
|



Add support for importing/exporting pixel size metadata via TIFF/OME-TIFF.
The addition of this feature would allow the development of features specified in #3029 as well as being a fundamental first step in solving issues #967 and #2870 .
GSoC Submission:
This PR is my main code submission; you can also find a blog on the process here, as well as a PR for documentation update here. In one route to implement this feature, I contributed PRs to both Ilastik and VIGRA; that particular route ultimately failed due to forwards compatibility issues, but you can find the closed PRs here and here.
The main goal of the project was to implement the reading and writing of pixel sizes in Ilastik via TIFF files. This pull request achieves that goal. There were some significant challenges in achieving this (which are detailed in the blog), hence a lack of extension features, but I am working on and intend to contribute features utilising pixel sizes beyond GSoC 2025.
Checklist