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

Stitching fails on Windows due to temp_mmap array size error #111

Open
MarcMarc94 opened this issue Nov 15, 2024 · 0 comments
Open

Stitching fails on Windows due to temp_mmap array size error #111

MarcMarc94 opened this issue Nov 15, 2024 · 0 comments

Comments

@MarcMarc94
Copy link
Collaborator

Initialization of stitcher and generation of thumbnail works but during stitching an error occurs:

stitcher = Stitcher(os.path.abspath(input_dir),
slidename,
outdir,
pattern = pattern,
stitching_channel = stitching_channel,
overlap= overlap,
max_shift= max_shift,
filter_sigma = 0,
rescale_range = (1,99),
overwrite=True)

stitcher.generate_thumbnail()

stitcher.stitch()

Output:

performing stitching on channel Alexa488 with id number 0
quantifying alignment error 1000/1000
aligning edge 3901/3901

WARNING:root:Folder C:\Users\bias\AppData\Local\Temp\temp_mmap_ckhrll70 with temp mmap arrays is being deleted. All existing temp mmapp arrays will be unusable!
WARNING:root:New temp folder location. Temp mmap arrays are written to ..\24_11_01_scportrait_windows_test\temp_mmap_jn9d_yg3. Cleanup of this folder is OS dependant, and might need to be triggered manually!

Alignment complete.
assembling mosaic with shape (4, 151184, 51196)
created tempmmap array for assembled mosaic at ...\24_11_01_scportrait_windows_test\temp_mmap_jn9d_yg3\temp_mmap_583388589321156577.hdf


ValueError Traceback (most recent call last)
Cell In[13], line 1
----> 1 stitcher.stitch()

File D:\scportrait\scPortrait\src\scportrait\tools\stitch_stitch.py:449, in Stitcher.stitch(self)
445 """
446 Perform the stitching process.
447 """
448 self.perform_alignment()
--> 449 self.generate_mosaic()

File D:\scportrait\scPortrait\src\scportrait\tools\stitch_stitch.py:442, in Stitcher.generate_mosaic(self)
440 # ensure dtype is set correctly
441 self.mosaic.dtype = np.uint16
--> 442 self.assemble_mosaic()

File D:\scportrait\scPortrait\src\scportrait\tools\stitch_stitch.py:415, in Stitcher.assemble_mosaic(self)
413 hdf5_path = create_empty_mmap(shape, dtype=np.uint16, tmp_dir_abs_path=self.TEMP_DIR_NAME)
414 print(f"created tempmmap array for assembled mosaic at {hdf5_path}")
--> 415 self.assembled_mosaic = mmap_array_from_path(hdf5_path)
416 self.hdf5_path = hdf5_path # save variable into self for easier access
418 # assemble each of the channels

File ~\anaconda3\envs\scportrait\Lib\site-packages\alphabase\io\tempmmap.py:262, in mmap_array_from_path(hdf_file)
258 with open(path, "rb+") as raw_hdf_file:
259 mmap_obj = mmap.mmap(raw_hdf_file.fileno(), 0, access=mmap.ACCESS_WRITE)
260 return np.frombuffer(
261 mmap_obj, dtype=dtype, count=np.prod(shape), offset=offset
--> 262 ).reshape(shape)

ValueError: cannot reshape array of size 895293184 into shape (4,151184,51196)

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

1 participant