Skip to content

[BUG] 5D datasource support missing in .psf saving #1669

@barentine

Description

@barentine

Describe the bug

 Error whilst running File>&Save As
==============================================
python-microscopy=26.03.26.post0.dev[git]
python=3.11.14, platform=win32
numpy=2.4.2, wx=4.2.4 msw (phoenix) wxWidgets 3.2.8

Traceback
=========
Traceback (most recent call last):
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\ui\progress.py", line 153, in func
    return fcn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\DSView\dsviewer.py", line 322, in OnSave
    self.image.Save()
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\IO\image.py", line 1476, in Save
    self.save(filename=filename, crop=crop, roi=roi, progressCallback=progressCallback)
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\IO\image.py", line 1511, in save
    self.filename = dataExporter.ExportData(self.data_xyztc, self.mdh, self.events, defaultExt=self.defaultExt, filename=filename, progressCallback=progressCallback)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\IO\dataExporter.py", line 467, in ExportData
    exp.Export(ds, filename, slice(0, ds.shape[0], 1), slice(0, ds.shape[1], 1), slice(0, ds.shape[2], 1),mdh, events, origName, progressCallback=progressCallback)
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\IO\dataExporter.py", line 377, in Export
    cPickle.dump((data[xslice, yslice, zslice], metadata['voxelsize']), fid, 2)
                  ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\IO\DataSources\BaseDataSource.py", line 317, in __getitem__
    raise IndexError('Must provide slices/indices for all 5 dimensions')
IndexError: Must provide slices/indices for all 5 dimensions

To Reproduce
Steps to reproduce the behavior:

  1. Open a single channel h5 file
  2. Extract a PSF
  3. File>Save as, select .psf file type
  4. See error

Note, saves fine to .h5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions