Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ngff branch #22

Open
mzouink opened this issue Jan 23, 2025 · 3 comments
Open

Ngff branch #22

mzouink opened this issue Jan 23, 2025 · 3 comments

Comments

@mzouink
Copy link
Contributor

mzouink commented Jan 23, 2025

By running :

from funlib.persistence import open_ome_ds
from pathlib import Path
ome_data = open_ome_ds(Path("/nrs/cellmap/data/jrc_mus-pancreas-5/jrc_mus-pancreas-5.zarr/recon-1/em/fibsem-uint8"),"s0")

I get :

AttributeError                            Traceback (most recent call last)
File /groups/cellmap/cellmap/zouinkhim/cellmap_vit/tmp.py:5
      2 from pathlib import Path
      4 p = Path("/nrs/cellmap/data/jrc_mus-pancreas-5/jrc_mus-pancreas-5.zarr/recon-1/em/fibsem-uint8")
----> 5 d = open_ome_ds(p,"s0")

File ~/miniconda3/envs/cflow_v2/lib/python3.11/site-packages/funlib/persistence/arrays/ome_datasets.py:59, in open_ome_ds(store, name, mode, **kwargs)
     56 units = [axis.unit for axis in axes if axis.unit is not None]
     57 types = [axis.type for axis in axes if axis.type is not None]
---> 59 scale = get_effective_scale(ome_zarr, name)
     60 offset = get_effective_translation(ome_zarr, name)
     62 dataset = ome_zarr[name]

File ~/miniconda3/envs/cflow_v2/lib/python3.11/site-packages/funlib/persistence/arrays/ome_tmp.py:57, in get_effective_scale(node, image)
     38 def get_effective_scale(
     39     node,
     40     image: str | Literal["*"],
     41 ) -> list[float]:
     42     """Get the effective coordinate scale metadata
     43     for one image array or the whole FOV.
     44 
   (...)
     55         for the image or FOV for each axis.
     56     """
...
     26     )
     27     if image != "*" and image in node:
     28         for i, dataset_meta in enumerate(node.metadata.multiscales[0].datasets):

AttributeError: 'Position' object has no attribute 'metadata'

.zattrs:

{
    "axes": [
        "x",
        "y",
        "z"
    ],
    "multiscales": [
        {
            "axes": [
                {
                    "name": "z",
                    "type": "space",
                    "unit": "nanometer"
                },
                {
                    "name": "y",
                    "type": "space",
                    "unit": "nanometer"
                },
                {
                    "name": "x",
                    "type": "space",
                    "unit": "nanometer"
                }
            ],
            "coordinateTransformations": [
                {
                    "scale": [
                        1.0,
                        1.0,
                        1.0
                    ],
                    "type": "scale"
                }
            ],
            "datasets": [
                {
                    "coordinateTransformations": [
                        {
                            "scale": [
                                8.0,
                                8.0,
                                8.0
                            ],
                            "type": "scale"
                        },
                        {
                            "translation": [
                                0.0,
                                0.0,
                                0.0
                            ],
                            "type": "translation"
                        }
                    ],
                    "path": "s0"
                },
                {
                    "coordinateTransformations": [
                        {
                            "scale": [
                                16.0,
                                16.0,
                                16.0
                            ],
                            "type": "scale"
                        },
                        {
                            "translation": [
                                4.0,
                                4.0,
                                4.0
                            ],
                            "type": "translation"
                        }
                    ],
                    "path": "s1"
                },
                {
                    "coordinateTransformations": [
                        {
                            "scale": [
                                32.0,
                                32.0,
                                32.0
                            ],
                            "type": "scale"
                        },
                        {
                            "translation": [
                                12.0,
                                12.0,
                                12.0
                            ],
                            "type": "translation"
                        }
                    ],
                    "path": "s2"
                },
                {
                    "coordinateTransformations": [
                        {
                            "scale": [
                                64.0,
                                64.0,
                                64.0
                            ],
                            "type": "scale"
                        },
                        {
                            "translation": [
                                28.0,
                                28.0,
                                28.0
                            ],
                            "type": "translation"
                        }
                    ],
                    "path": "s3"
                },
                {
                    "coordinateTransformations": [
                        {
                            "scale": [
                                128.0,
                                128.0,
                                128.0
                            ],
                            "type": "scale"
                        },
                        {
                            "translation": [
                                60.0,
                                60.0,
                                60.0
                            ],
                            "type": "translation"
                        }
                    ],
                    "path": "s4"
                },
                {
                    "coordinateTransformations": [
                        {
                            "scale": [
                                256.0,
                                256.0,
                                256.0
                            ],
                            "type": "scale"
                        },
                        {
                            "translation": [
                                124.0,
                                124.0,
                                124.0
                            ],
                            "type": "translation"
                        }
                    ],
                    "path": "s5"
                },
                {
                    "coordinateTransformations": [
                        {
                            "scale": [
                                512.0,
                                512.0,
                                512.0
                            ],
                            "type": "scale"
                        },
                        {
                            "translation": [
                                252.0,
                                252.0,
                                252.0
                            ],
                            "type": "translation"
                        }
                    ],
                    "path": "s6"
                },
                {
                    "coordinateTransformations": [
                        {
                            "scale": [
                                1024.0,
                                1024.0,
                                1024.0
                            ],
                            "type": "scale"
                        },
                        {
                            "translation": [
                                508.0,
                                508.0,
                                508.0
                            ],
                            "type": "translation"
                        }
                    ],
                    "path": "s7"
                }
            ],
            "name": "/recon-1/em/fibsem-uint8",
            "version": "0.4"
        }
    ],
    "ordering": "F",
    "pixelResolution": {
        "dimensions": [
            8.0,
            8.0,
            8.0
        ],
        "unit": "nm"
    },
    "renderExport": {
        "runParameters": {
            "blockSizeString": "128,128,64",
            "downsampleFactorsString": "2,2,2",
            "exportMask": false,
            "layerBounds": {},
            "layerRange": {},
            "n5Dataset": "/render/jrc_mus_pancreas_5/v3_acquire_align_destreak_ic3d_64x64_zd_1___20240906_081518",
            "n5Path": "/nrs/cellmap/data/jrc_mus-pancreas-5/jrc_mus-pancreas-5.n5",
            "renderWeb": {
                "baseDataUrl": "http://10.40.3.113:8080/render-ws/v1",
                "owner": "cellmap",
                "project": "jrc_mus_pancreas_5"
            },
            "stack": "v3_acquire_align_destreak_ic3d_64x64_zd_1",
            "stackResolutionUnit": "nm",
            "tileHeight": 4096,
            "tileWidth": 4096
        },
        "runTimestamp": "Sep 6, 2024, 8:16:09 AM",
        "stackMetadata": {
            "currentVersion": {
                "createTimestamp": "Aug 31, 2024, 10:30:33 AM",
                "stackResolutionX": 8.0,
                "stackResolutionY": 8.0,
                "stackResolutionZ": 8.0,
                "versionNotes": "derived from stack with owner 'cellmap', project 'jrc_mus_pancreas_5', and name 'v3_acquire_align_destreak'"
            },
            "currentVersionNumber": 0,
            "lastModifiedTimestamp": "Sep 1, 2024, 2:50:21 PM",
            "stackId": {
                "owner": "cellmap",
                "project": "jrc_mus_pancreas_5",
                "stack": "v3_acquire_align_destreak_ic3d_64x64_zd_1"
            },
            "state": "COMPLETE",
            "stats": {
                "channelNames": [],
                "maxTileHeight": 8281,
                "maxTileWidth": 8610,
                "minTileHeight": 8264,
                "minTileWidth": 8597,
                "nonIntegralSectionCount": 0,
                "sectionCount": 151,
                "stackBounds": {
                    "maxX": 16723.0,
                    "maxY": 8132.0,
                    "maxZ": 7250.0,
                    "minX": -17044.0,
                    "minY": -8219.0,
                    "minZ": 7100.0
                },
                "tileCount": 1208,
                "transformCount": 1
            }
        }
    },
    "scales": [
        [
            1,
            1,
            1
        ],
        [
            2,
            2,
            2
        ],
        [
            4,
            4,
            4
        ],
        [
            8,
            8,
            8
        ],
        [
            16,
            16,
            16
        ],
        [
            32,
            32,
            32
        ],
        [
            64,
            64,
            64
        ],
        [
            128,
            128,
            128
        ]
    ],
    "translate": [
        -17044,
        -8219,
        7100
    ],
    "units": [
        "nm",
        "nm",
        "nm"
    ]
}

@pattonw

@pattonw
Copy link
Contributor

pattonw commented Jan 24, 2025

I don't think it's valid ome zarr metadata unless there's a "omero" attribute with a list of channel names.
At least that is what iohub seems to expect and the ngff spec says it should be there. The language makes it a little unclear if it's mandatory or not

@mzouink
Copy link
Contributor Author

mzouink commented Jan 24, 2025

@yuriyzubov can you check this ?

@yuriyzubov
Copy link
Contributor

yuriyzubov commented Jan 25, 2025

@pattonw is right, the lack of "omero" attribute caused the error.
Adding

{
    "id": 1,                            
    "name": "mus-pancreas-5",              
    "version": "0.4",                     
    "channels": [                        
       {
          "active": true,
          "coefficient": 1,
          "color": "FFFFFF",
          "inverted": false,
          "label": "mus-pancreas-5",
          "window": {
                "end": 255,
                "max": 255,
                "min": 0,
                "start": 0
          }
       }
    ],
    "rdefs": {
       "defaultT": 0,                    
       "defaultZ": 0,                 
       "model": "greyscale"                  
    }
},

fixed the validation issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants