mahmoodlab / CLAM

Open source tools for computational pathology - Nature BME
http://clam.mahmoodlab.org
GNU General Public License v3.0
1.14k stars 366 forks source link

Run your own dataset #213

Closed Tanhongyun closed 2 months ago

Tanhongyun commented 1 year ago

Hello, it seems like you're encountering an error while trying to convert your dataset from NIfTI format (nii.gz) to TIFF format (tif). The error message you provided indicates a problem with the code or data you are working with. Here's a translation of the error message and an explanation of the issue: progress: 0.00, 0/1 processing PD_175.tiff Traceback (most recent call last): File "/home/chenwj/anaconda3/envs/clam/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 1432, in squeeze squeeze = a.squeeze AttributeError: 'NoneType' object has no attribute 'squeeze'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "create_patches_fp.py", line 309, in process_list=process_list, auto_skip=args.no_auto_skip) File "create_patches_fp.py", line 185, in seg_and_patch WSI_object, seg_time_elapsed = segment(WSI_object, current_seg_params, current_filter_params) File "create_patches_fp.py", line 30, in segment WSI_object.segmentTissue(*seg_params, filter_params=filter_params) File "/home/chenwj/clam/CLAM/wsi_core/WholeSlideImage.py", line 169, in segmentTissue hierarchy = np.squeeze(hierarchy, axis=(0,))[:, 2:] File "<__array_function__ internals>", line 6, in squeeze File "/home/chenwj/anaconda3/envs/clam/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 1434, in squeeze return _wrapit(a, 'squeeze', axis=axis) File "/home/chenwj/anaconda3/envs/clam/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 47, in _wrapit result = getattr(asarray(obj), method)(args, **kwds) numpy.AxisError: axis 0 is out of bounds for array of dimension 0

XNN19 commented 10 months ago

Hi, did you solve this problem? I meet the same one :(

siemdejong commented 10 months ago

I experienced this issue too. For me this happened, because I tried to use binary masks as a proxy and use those to get opencv contours. This didn't work, as the binary rgb images were converted to hsv color space internally, resulting in only zeros in the saturation channel. The saturation channel is used to compute contours on, resulting in no contours. Since there was no contour/hierarchy, hierarchy = np.squeeze(hierarchy, axis=(0,))[:, 2:] failed.