Git Product home page Git Product logo

python-wsi-preprocessing's People

Contributors

deroneriksson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-wsi-preprocessing's Issues

"Image.fromarray" causes "OverflowError: size does not fit in an int" error in large scale images

I am using this code for processing Whole Slide Images (.svs format). This code running well when NUM_TOP_TILES = 50 to NUM_TOP_TILES = 12000. As Whole Slide Images are very large in size, in that case if I increase NUM_TOP_TILES>12000, I'm getting OverflowError: size does not fit in an int error. This is very common issue with Pillow when large images were used. There are many solutions are available in the github and StackOverFlow but I'm not able to solve my issue. As per my analysis,Image.fromarray() of Pillow in the below function causing this issue. It will be a great help if anyone suggest any solution to solve this issue. I have given related function and error traceback for your reference.

Function:

def np_to_pil(np_img):
  """
  Convert a NumPy array to a PIL Image.
  Args:
    np_img: The image represented as a NumPy array.
  Returns:
     The NumPy array converted to a PIL Image.
  """
  if np_img.dtype == "bool":
    np_img = np_img.astype("uint8") * 255
  elif np_img.dtype == "float64":
    np_img = (np_img * 255).astype("uint8")
return Image.fromarray(np_img)

Error Traceback

Traceback (most recent call last):

File "WsiToImagePatch.py", line 35, in np_to_pil return Image.fromarray(np_img) File "/usr/local/lib/python3.5/dist-packages/PIL/Image.py", line 2536, in fromarray return frombuffer(mode, size, obj, "raw", rawmode, 0, 1) File "/usr/local/lib/python3.5/dist-packages/PIL/Image.py", line 2479, in frombuffer return frombytes(mode, size, data, decoder_name, args) File "/usr/local/lib/python3.5/dist-packages/PIL/Image.py", line 2412, in frombytes im.frombytes(data, decoder_name, args) File "/usr/local/lib/python3.5/dist-packages/PIL/Image.py", line 812, in frombytes s = d.decode(data) OverflowError: size does not fit in an int

Reverse of tile operation

Hello!
Is there any option where we can rejoin the tiled images?
I am feeding the tiled images to a CNN (input size is small) and recombine each processed tiles to original image.

Facing issues with the Level-Dimensions in Leica .scn Images

Hi @deroneriksson

I have gone through your blog and found it very useful. However I am facing issues regarding the WSI Level for Leica .scn images. Whenever i use the function slide_info() from the openslide package to get information about he dimensions, it gives incorrect information. The information doesn't seem to match the information from the image.

I am hereby attaching the details of 2 WSI and their information from the slide_info() function and from the actual WSI. The width and height at each and every level dont seem to match at all. As a result I get tiles with huge y-coordinates and few tiles are completely black. For two different WSI , openslide slide_info() function gives same level values and same dimensions which is not possible at all.

Request you to kindly inspect the issue and let me know about it, I am unable to proceed with my research. What is the workaround for such issues?

Regards,
Hitesha
a2
nims-002.txt
a4
nims-004.txt

Deprecated function call in filter_remove_small_holes

In tile_extraction/filter.py, in line 286, sk_morphology.remove_small_holes is called with the parameter name min_size.
This probably worked for earlier versions of the sk_morphology function, but it now raises an error, as the function now expects the parameter area_threshold, which is probably equivalent with what min_size once meant.
-> filter.py needs to be adapted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.