arttumiettinen / pi2

C++ library and command-line software for processing and analysis of terabyte-scale volume images locally or on a computing cluster.
GNU General Public License v3.0
48 stars 13 forks source link

Out of memory running nr_stitcher.py on windows 10 #6

Closed zhusihan-python closed 2 years ago

zhusihan-python commented 2 years ago

hello sir, im trying to find a tool to stitch microscope tiles into a whole slide image tiff file, when running nr_stitcher on my pc, i got this error:

Reading stitch settings from stitch_settings.txt
flat_000_000.jpg at position [0. 0. 0.], size = [2147483647 2147483647 2147483647]
flat_001_007.jpg at position [2796.    0.    0.], size = [2147483647 2147483647 2147483647]
flat_002_000.jpg at position [5592.    0.    0.], size = [2147483647 2147483647 2147483647]
flat_003_007.jpg at position [8388.    0.    0.], size = [2147483647 2147483647 2147483647]
flat_004_000.jpg at position [11184.     0.     0.], size = [2147483647 2147483647 2147483647]
flat_005_007.jpg at position [13980.     0.     0.], size = [2147483647 2147483647 2147483647]
Calculate displacement field 0 -> 1
blockmatchmemsave("flat_000_000.jpg", "flat_001_007.jpg", "2796", "2147483647", "30", "0", "2147483647", "30", "0", "2147483647", "30", "[-2796, 0, 0]", "stitched_0-1", "[60]", "2", "[1]", "2", "True")
Traceback (most recent call last):
  File "F:\projects\pi2\python_scripts\nr_stitcher.py", line 233, in <module>
    main()
  File "F:\projects\pi2\python_scripts\nr_stitcher.py", line 219, in main
    if calculate_displacement_fields(settings.sample_name, relations, settings.point_spacing, settings.coarse_block_radius, settings.coarse_binning, settings.fine_block_radius, settings.fine_binning, settings.normalize_in_blockmatch, settings.filter_threshold, settings.force_redo):
  File "F:\projects\pi2\python_scripts\base.py", line 578, in calculate_displacement_fields
    calculate_displacement_field(sample_name, scan1, scan2, point_spacing, coarse_block_radius, coarse_binning, fine_block_radius, fine_binning, normalize, filter_threshold)
  File "F:\projects\pi2\python_scripts\base.py", line 335, in calculate_displacement_field
    run_pi2(params, file_prefix)
  File "F:\projects\pi2\python_scripts\base.py", line 106, in run_pi2
    pi.submitjob(pi_script, "normal")
  File "F:\projects\pi2\python_scripts\pi2py2.py", line 591, in <lambda>
    func = lambda *args: self.run_command(cmd_name, args)
  File "F:\projects\pi2\python_scripts\pi2py2.py", line 741, in run_command
    self.run_script(cmd_line)
  File "F:\projects\pi2\python_scripts\pi2py2.py", line 697, in run_script
    self.raise_last_error()
  File "F:\projects\pi2\python_scripts\pi2py2.py", line 687, in raise_last_error
    raise RuntimeError(err)
RuntimeError: Out of memory.

Process finished with exit code 1

my environment windows10, Python 3.9.13, pi2_v4.3-win-no-opencl my config file: stitch_settings.txt

arttumiettinen commented 2 years ago

Hi,

Thanks for reporting the issue.

The problem is that pi2 does not support jpg files at the moment, and nrstitcher script does not seem to correctly report this. I will fix that after summer holidays. Meanwhile, a workaround is to convert the input files e.g. to .tiff.

A list of supported file formats is available at https://pi2-docs.readthedocs.io/en/latest/io.html

arttumiettinen commented 2 years ago

This issue is fixed in the experimental branch (commit 90aaee1ed96f85bdeb52f767d3bb9dd788d87371). Nrstitcher script now gives a meaningful error message if input image file type is not supported. Additionally, jpeg file format support has been added.