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

Z dimension not detected for preview rigid stitching #147

Open
stellalessandra opened this issue Sep 9, 2024 · 1 comment
Open

Z dimension not detected for preview rigid stitching #147

stellalessandra opened this issue Sep 9, 2024 · 1 comment

Comments

@stellalessandra
Copy link

I am trying to stitch a large image of a Mouse Whole Brain of a single channel without autofluorescence, acquired by a LSFM, using the ClearMap GUI.
I have raw tile files already converted to .npy, where the XYZ factoring is:
raw/10-44-28_BL45_ctrl_cfos_UltraII[<Y,2> x <X,2>]_C00_xyz-Table Z<Z,4>.ome.tif

The workspace also shows the correct information:
Workspace[CellMap]{/home/clearmap/Documents/test_cm}
raw: raw/10-44-28_BL45_ctrl_cfos_UltraII[<Y,2> x <X,2>]_C00_xyz-Table Z<Z,4>.ome.npy {15180 files, ('Y', 'X', 'Z'): (0, 0, 0) -> (3, 2, 1264)}
raw/10-44-28_BL45_ctrl_cfos_UltraII[<Y,2> x <X,2>]_C00_xyz-Table Z<Z,4>.ome.tif {15180 files, ('Y', 'X', 'Z'): (0, 0, 0) -> (3, 2, 1264)}
autofluorescence: no file
stitched: no file
layout: no file
background: no file
resampled: no file
resampled_to_auto: no file
auto_to_reference: no file
cells: no file
density: no file
tile_extension: no file

However, it seems like the program is not able to acquire the Z dimension, as it gives the following error after clicking the Rigid Stitching Preview button:

Traceback (most recent call last): File "/home/clearmap/miniconda3/envs/ClearMapUi39/lib/python3.9/site-packages/ClearMap2-2.1.4-py3.9-linux-x86_64.egg/ClearMap/gui/tabs.py", line 417, in preview_stitching_dumb overlay = [pg.image(self.preprocessor.stitch_overlay('raw', color))] File "/home/clearmap/miniconda3/envs/ClearMapUi39/lib/python3.9/site-packages/ClearMap2-2.1.4-py3.9-linux-x86_64.egg/ClearMap/processors/sample_preparation.py", line 754, in stitch_overlay middle_z = int(tile_shape['Z'] / 2) KeyError: 'Z'

I would be happy to receive any clarification on how to solve the issue.
Best regards
Alessandra

@crousseau
Copy link
Collaborator

crousseau commented Sep 10, 2024

Hi,
@stellalessandra
this is indeed currently not implemented but is planned for the next version (hopefully next month). In the mean time, you can try to stack your columns using this:

from ClearMap.IO import IO as clmio
from ClearMap.Utils.tag_expression import Expression


base_pattern = /.../raw/10-44-28_BL45_ctrl_cfos_UltraII[<Y,2> x <X,2>]_C00_xyz-Table Z<Z,4>.ome.npy   # replace ... by your source folder
exp = Expression(base_pattern)

for y in range(3):
    for x in range(2):
        column_expression = exp.string(values={'X': x, 'Y': y})
        dest = column_expression.replace('_xyz-Table Z<Z,4>', '')
        clmio.convert(column_expression, dest)

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

2 participants