File tree Expand file tree Collapse file tree 5 files changed +25
-26
lines changed
Expand file tree Collapse file tree 5 files changed +25
-26
lines changed Original file line number Diff line number Diff line change 2626execution graph.
2727
2828"""
29- from . import configure , codecs
29+ from . import configure , codecs # noqa: F401,E402
Original file line number Diff line number Diff line change 1818
1919"""Whole-slide image streamer for machine learning frameworks.
2020
21- The histomics_stream.codecs module supplies codecs that are useful for Zarr file storage with jpeg or
22- jpeg2k compression.
21+ The histomics_stream.codecs module supplies codecs that are useful for Zarr file storage
22+ with jpeg or jpeg2k compression.
2323
2424"""
2525
@@ -39,10 +39,10 @@ class jpeg(Codec):
3939
4040 Notes
4141 -----
42- For the code that uses Zarr data storage for jpeg images, we need to supply codecs. Note that we
43- use this codec instead of that available from the zarr_jpeg package. The latter collapses
44- dimensions by default, can require us to transpose dimensions, and can miss optimizations based upon
45- RGB data.
42+ For the code that uses Zarr data storage for jpeg images, we need to supply codecs.
43+ Note that we use this codec instead of that available from the zarr_jpeg package.
44+ The latter collapses dimensions by default, can require us to transpose dimensions,
45+ and can miss optimizations based upon RGB data.
4646
4747 """
4848
Original file line number Diff line number Diff line change 1818
1919"""Whole-slide image streamer for machine learning frameworks."""
2020
21+ import numpy as np
22+ import torch
23+ from . import configure
24+
2125"""
2226See: How to load a list of numpy arrays to pytorch dataset loader?
2327https://stackoverflow.com/questions/44429199/how-to-load-a-list-of-numpy-arrays-to-pytorch-dataset-loader
3337"""
3438See: A Comprehensive Guide to the DataLoader Class and Abstractions in PyTorch
3539https://blog.paperspace.com/dataloaders-abstractions-pytorch/
36-
3740"""
3841
39- import numpy as np
40- import torch
41-
42- from . import configure
43-
4442
4543class CreateTorchDataloader (configure .ChunkLocations ):
4644 class MyDataset (torch .utils .data .IterableDataset , configure ._TilesByCommon ):
Original file line number Diff line number Diff line change @@ -36,9 +36,10 @@ def test_create_study():
3636
3737 # Add a slide to the study, including slide-wide information with it.
3838 my_slide0 = my_slides ["Slide_0" ] = {}
39- my_slide0 [
40- "filename"
41- ] = "/tf/notebooks/histomics_stream/example/TCGA-BH-A0BZ-01Z-00-DX1.45EB3E93-A871-49C6-9EAE-90D98AE01913.svs"
39+ my_slide0 ["filename" ] = (
40+ "/tf/notebooks/histomics_stream/example/"
41+ "TCGA-BH-A0BZ-01Z-00-DX1.45EB3E93-A871-49C6-9EAE-90D98AE01913.svs"
42+ )
4243 my_slide0 ["slide_name" ] = "TCGA-BH-A0BZ-01Z-00-DX1"
4344 my_slide0 ["slide_group" ] = "TCGA-BH-A0BZ"
4445 my_slide0 ["chunk_height" ] = 2048
@@ -81,7 +82,8 @@ def test_create_study():
8182 my_study_by_grid_and_mask ,
8283 overlap_height = 0 ,
8384 overlap_width = 0 ,
84- mask_filename = "/tf/notebooks/histomics_stream/example/TCGA-BH-A0BZ-01Z-00-DX1.45EB3E93-A871-49C6-9EAE-90D98AE01913-mask.png" ,
85+ mask_filename = "/tf/notebooks/histomics_stream/example/"
86+ "TCGA-BH-A0BZ-01Z-00-DX1.45EB3E93-A871-49C6-9EAE-90D98AE01913-mask.png" ,
8587 randomly_select = 100 ,
8688 )
8789 # We could apply this to a subset of the slides, but we will apply it to all
Original file line number Diff line number Diff line change 2222def test_imports_can_be_found ():
2323 """Purpose: Test to check that each import can be found"""
2424
25- # Import succeeds
26- import imagecodecs
27- import itk
28- import numcodecs
29- import numpy
30- import scipy .interpolate
31- import tensorflow
32- import torch
33- import zarr
25+ import imagecodecs # noqa: F401
26+ import itk # noqa: F401
27+ import numcodecs # noqa: F401
28+ import numpy # noqa: F401
29+ import scipy .interpolate # noqa: F401
30+ import tensorflow # noqa: F401
31+ import torch # noqa: F401
32+ import zarr # noqa: F401
3433
3534
3635if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments