Skip to content

Commit

Permalink
Remove redundant array copy for WSITiffFileReader (#6089)
Browse files Browse the repository at this point in the history
Fixes #5580 

### Description
This PR remove an "unnecessary" array copy in WSITiffFileReader, which
was causing an slow down in loading whole slide images.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>
  • Loading branch information
drbeh authored Mar 2, 2023
1 parent c8284d6 commit 934ba09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion monai/data/wsi_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ def _get_patch(
# Extract patch
downsampling_ratio = self.get_downsample_ratio(wsi=wsi, level=level)
location_ = [round(location[i] / downsampling_ratio) for i in range(len(location))]
patch = wsi_image[location_[0] : location_[0] + size[0], location_[1] : location_[1] + size[1], :].copy()
patch = wsi_image[location_[0] : location_[0] + size[0], location_[1] : location_[1] + size[1], :]

# Make the channel to desired dimensions
patch = np.moveaxis(patch, -1, self.channel_dim)
Expand Down

0 comments on commit 934ba09

Please sign in to comment.