error Traceback (most recent call last)
Cell In[12], line 1
----> 1 pnt.interpolate_volume(
2 segmentation_folder=segmentation_folder,
3 alignment_json=alignment_json,
4 colour=colour,
5 atlas=atlas,
6 )
File ~/github/PyNutil/PyNutil/processing/section_volume.py:549, in interpolate_volume(segmentation_folder, alignment_json, colour, atlas, scale, missing_fill, do_interpolation, k, batch_size, use_atlas_mask, value_mode, segmentation_format, segmentation_mode, intensity_channel, min_intensity, max_intensity, return_orientation)
544 ov_flat = (
545 np.zeros((gv.size,), dtype=np.uint32) if value_mode == "object_count" else None
546 )
548 for seg_path in seg_paths:
--> 549 _process_one_section(seg_path, slice_by_nr, vol_cfg, gv, fv, dv, ov_flat)
551 gv, fv, dv = _finalize_volumes(gv, fv, dv, ov_flat, vol_cfg, interp_cfg)
553 if return_orientation != "lpi":
File ~/github/PyNutil/PyNutil/processing/section_volume.py:372, in _process_one_section(seg_path, slice_by_nr, vol_cfg, gv, fv, dv, ov_flat)
366 values_reg = cv2.resize(
367 src, (reg_width, reg_height), interpolation=cv2.INTER_NEAREST
368 )
370 # Sample, deform, and remap the plane
371 sampled_2d, vals, damage_vals, flat_x, flat_y, plane_h, plane_w = (
--> 372 _sample_and_deform_plane(slice_info, values_reg, damage_reg, vol_cfg)
373 )
375 # Transform flat grid to atlas-space 3-D coordinates
376 coords = transform_to_atlas_space(slice_info, flat_y, flat_x)
File ~/github/PyNutil/PyNutil/processing/section_volume.py:194, in _sample_and_deform_plane(slice_info, values_reg, damage_reg, vol_cfg)
191 map_x = reg_x.astype(np.float32, copy=False)
192 map_y = reg_y.astype(np.float32, copy=False)
--> 194 sampled_2d = cv2.remap(
195 values_reg,
196 map_x,
197 map_y,
198 interpolation=cv2.INTER_NEAREST,
199 borderMode=cv2.BORDER_CONSTANT,
200 borderValue=0,
201 )
202 vals_flat = sampled_2d.reshape(-1).astype(np.float32, copy=False)
204 damage_vals = None
error: OpenCV(4.11.0) /io/opencv/modules/imgproc/src/imgwarp.cpp:1813: error: (-215:Assertion failed) dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && src.rows < SHRT_MAX in function 'remap'
error Traceback (most recent call last)
Cell In[12], line 1
----> 1 pnt.interpolate_volume(
2 segmentation_folder=segmentation_folder,
3 alignment_json=alignment_json,
4 colour=colour,
5 atlas=atlas,
6 )
File ~/github/PyNutil/PyNutil/processing/section_volume.py:549, in interpolate_volume(segmentation_folder, alignment_json, colour, atlas, scale, missing_fill, do_interpolation, k, batch_size, use_atlas_mask, value_mode, segmentation_format, segmentation_mode, intensity_channel, min_intensity, max_intensity, return_orientation)
544 ov_flat = (
545 np.zeros((gv.size,), dtype=np.uint32) if value_mode == "object_count" else None
546 )
548 for seg_path in seg_paths:
--> 549 _process_one_section(seg_path, slice_by_nr, vol_cfg, gv, fv, dv, ov_flat)
551 gv, fv, dv = _finalize_volumes(gv, fv, dv, ov_flat, vol_cfg, interp_cfg)
553 if return_orientation != "lpi":
File ~/github/PyNutil/PyNutil/processing/section_volume.py:372, in _process_one_section(seg_path, slice_by_nr, vol_cfg, gv, fv, dv, ov_flat)
366 values_reg = cv2.resize(
367 src, (reg_width, reg_height), interpolation=cv2.INTER_NEAREST
368 )
370 # Sample, deform, and remap the plane
371 sampled_2d, vals, damage_vals, flat_x, flat_y, plane_h, plane_w = (
--> 372 _sample_and_deform_plane(slice_info, values_reg, damage_reg, vol_cfg)
373 )
375 # Transform flat grid to atlas-space 3-D coordinates
376 coords = transform_to_atlas_space(slice_info, flat_y, flat_x)
File ~/github/PyNutil/PyNutil/processing/section_volume.py:194, in _sample_and_deform_plane(slice_info, values_reg, damage_reg, vol_cfg)
191 map_x = reg_x.astype(np.float32, copy=False)
192 map_y = reg_y.astype(np.float32, copy=False)
--> 194 sampled_2d = cv2.remap(
195 values_reg,
196 map_x,
197 map_y,
198 interpolation=cv2.INTER_NEAREST,
199 borderMode=cv2.BORDER_CONSTANT,
200 borderValue=0,
201 )
202 vals_flat = sampled_2d.reshape(-1).astype(np.float32, copy=False)
204 damage_vals = None
error: OpenCV(4.11.0) /io/opencv/modules/imgproc/src/imgwarp.cpp:1813: error: (-215:Assertion failed) dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && src.rows < SHRT_MAX in function 'remap'