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

Compatibility of ENACT with Visium HD Data in TIF Format #19

Open
LCGaoZzz opened this issue Dec 21, 2024 · 1 comment
Open

Compatibility of ENACT with Visium HD Data in TIF Format #19

LCGaoZzz opened this issue Dec 21, 2024 · 1 comment

Comments

@LCGaoZzz
Copy link

LCGaoZzz commented Dec 21, 2024

Hello,

I am currently working with Visium HD data from 10x Genomics, specifically the Visium HD CytAssist Gene Expression Libraries of Human Lung Cancer IF. I noticed that the microscope images for some datasets are provided in TIF format instead of BTF.

I attempted to run the ENACT software with this TIF format data, but encountered an error which prevents successful execution. Here is the error message:

pipeline.py (271): 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
pipeline.py (274): 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
2024-12-21 10:16:03,245 - ENACT - INFO - <load_image> Successfully loaded image!
2024-12-21 10:16:03,245 - ENACT - INFO - <load_image> Successfully loaded image!
INFO:ENACT:<load_image> Successfully loaded image!
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
[<ipython-input-7-2038a903d2ac>](https://localhost:8080/#) in <cell line: 21>()
     19 )
     20 
---> 21 so_hd.run_enact()

7 frames
[/usr/local/lib/python3.10/dist-packages/enact/pipeline.py](https://localhost:8080/#) in run_enact(self)
    996             # Run cell segmentation
    997             if self.segmentation:
--> 998                 wsi_norm = self.normalize_image(
    999                     image=wsi, min_percentile=5, max_percentile=95
   1000                 )

[/usr/local/lib/python3.10/dist-packages/enact/pipeline.py](https://localhost:8080/#) in normalize_image(self, image, min_percentile, max_percentile)
    297         """
    298         # Adjust min_percentile and max_percentile as needed
--> 299         image_norm = normalize(image, min_percentile, max_percentile)
    300         self.logger.info("<normalize_image> Successfully normalized image!")
    301         return image_norm

[/usr/local/lib/python3.10/dist-packages/csbdeep/utils/utils.py](https://localhost:8080/#) in normalize(x, pmin, pmax, axis, clip, eps, dtype)
     50     """Percentile-based image normalization."""
     51 
---> 52     mi = np.percentile(x,pmin,axis=axis,keepdims=True)
     53     ma = np.percentile(x,pmax,axis=axis,keepdims=True)
     54     return normalize_mi_ma(x, mi, ma, clip=clip, eps=eps, dtype=dtype)

[/usr/local/lib/python3.10/dist-packages/numpy/lib/function_base.py](https://localhost:8080/#) in percentile(a, q, axis, out, overwrite_input, method, keepdims, interpolation)
   4281     if not _quantile_is_valid(q):
   4282         raise ValueError("Percentiles must be in the range [0, 100]")
-> 4283     return _quantile_unchecked(
   4284         a, q, axis, out, overwrite_input, method, keepdims)
   4285 

[/usr/local/lib/python3.10/dist-packages/numpy/lib/function_base.py](https://localhost:8080/#) in _quantile_unchecked(a, q, axis, out, overwrite_input, method, keepdims)
   4553                         keepdims=False):
   4554     """Assumes that q is in [0, 1], and is an ndarray"""
-> 4555     return _ureduce(a,
   4556                     func=_quantile_ureduce_func,
   4557                     q=q,

[/usr/local/lib/python3.10/dist-packages/numpy/lib/function_base.py](https://localhost:8080/#) in _ureduce(a, func, keepdims, **kwargs)
   3821                 kwargs['out'] = out[(Ellipsis, ) + index_out]
   3822 
-> 3823     r = func(a, **kwargs)
   3824 
   3825     if out is not None:

[/usr/local/lib/python3.10/dist-packages/numpy/lib/function_base.py](https://localhost:8080/#) in _quantile_ureduce_func(a, q, axis, out, overwrite_input, method)
   4720         else:
   4721             arr = a.copy()
-> 4722     result = _quantile(arr,
   4723                        quantiles=q,
   4724                        axis=axis,

[/usr/local/lib/python3.10/dist-packages/numpy/lib/function_base.py](https://localhost:8080/#) in _quantile(arr, quantiles, axis, method, out)
   4833             slices_having_nans = None
   4834         # --- Get values from indexes
-> 4835         previous = arr[previous_indexes]
   4836         next = arr[next_indexes]
   4837         # --- Linear interpolation

IndexError: index 0 is out of bounds for axis 0 with size 0

Could you please advise if ENACT is compatible with TIF format files from Visium HD datasets, or if there are specific steps I should follow to convert these files into a compatible format? Any guidance on how to resolve this IndexError would also be greatly appreciated.

Thank you for your assistance and for the development of this useful tool.

@LCGaoZzz
Copy link
Author

LCGaoZzz commented Dec 21, 2024

I noticed that while some datasets work fine with the ENACT software, others lead to execution failures irrespective of the file format (no matter the inputs image's format is TIF or BTF).

I made multiple attempts with four different Visium HD datasets:

  1. Working datasets:

  2. Problematic datasets (same error as above):

Request for Assistance

Could you please advise if there are specific steps I should follow or adjustments needed to make ENACT compatible with these datasets? Any guidance on how to resolve the IndexError and DataFrame issues would be highly appreciated.

Thats wired..

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