Stack Stitcher Fails With 1x1 Slice
When reconstructing a stack where there is one by one em image in each direction, the script fails with the following error:
/home/eliott/.local/lib/python3.10/site-packages/BrainGenix/Tools/StackStitcher/StackStitcher.py:191: RuntimeWarning: invalid value encountered in scalar divide
xMax += (xMax - xMin) / (numX - 1)
/home/eliott/.local/lib/python3.10/site-packages/BrainGenix/Tools/StackStitcher/StackStitcher.py:192: RuntimeWarning: invalid value encountered in scalar divide
yMax += (yMax - yMin) / (numY - 1)
joblib.externals.loky.process_executor._RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/eliott/.local/lib/python3.10/site-packages/joblib/externals/loky/process_executor.py", line 463, in _process_worker
r = call_item()
File "/home/eliott/.local/lib/python3.10/site-packages/joblib/externals/loky/process_executor.py", line 291, in __call__
return self.fn(*self.args, **self.kwargs)
File "/home/eliott/.local/lib/python3.10/site-packages/joblib/parallel.py", line 589, in __call__
return [func(*args, **kwargs)
File "/home/eliott/.local/lib/python3.10/site-packages/joblib/parallel.py", line 589, in <listcomp>
return [func(*args, **kwargs)
File "/home/eliott/.local/lib/python3.10/site-packages/BrainGenix/Tools/StackStitcher/StackStitcher.py", line 307, in _doStitch
StitchOneSlice(
File "/home/eliott/.local/lib/python3.10/site-packages/BrainGenix/Tools/StackStitcher/StackStitcher.py", line 247, in StitchOneSlice
xCoordPx, yCoordPx = coordsToPixels(
File "/home/eliott/.local/lib/python3.10/site-packages/BrainGenix/Tools/StackStitcher/StackStitcher.py", line 155, in coordsToPixels
int((coord[0] - topLeft[0]) / (bottomRight[0] - topLeft[0]) * numX) + 1
ValueError: cannot convert float NaN to integer
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/eliott/Documents/vbp/src/models/e0_bs/./bs_vbp01_doubleblind_x_acquisition.py", line 241, in <module>
StitchManySlices("Renders/EM/Raw", "Renders/EM/Stitched", borderSizePx=3, nWorkers=4, makeGIF=True)
File "/home/eliott/.local/lib/python3.10/site-packages/BrainGenix/Tools/StackStitcher/StackStitcher.py", line 332, in StitchManySlices
Parallel(n_jobs=min(nWorkers, os.cpu_count()))(
File "/home/eliott/.local/lib/python3.10/site-packages/joblib/parallel.py", line 1952, in __call__
return output if self.return_generator else list(output)
File "/home/eliott/.local/lib/python3.10/site-packages/joblib/parallel.py", line 1595, in _get_outputs
yield from self._retrieve()
File "/home/eliott/.local/lib/python3.10/site-packages/joblib/parallel.py", line 1699, in _retrieve
self._raise_error_fast()
File "/home/eliott/.local/lib/python3.10/site-packages/joblib/parallel.py", line 1734, in _raise_error_fast
error_job.get_result(self.timeout)
File "/home/eliott/.local/lib/python3.10/site-packages/joblib/parallel.py", line 736, in get_result
return self._return_or_raise()
File "/home/eliott/.local/lib/python3.10/site-packages/joblib/parallel.py", line 754, in _return_or_raise
raise self._result
ValueError: cannot convert float NaN to integer
This can be reproduced by running the vbp e0_bs_00 and then e0_bs_01 scripts. (Or just make a test that only makes one by one images for each slice).