Skip to content

Commit

Permalink
Moving quicklook jpg to the bottom of the stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Draga Doncila Pop committed Jun 17, 2020
1 parent 4151a66 commit df33ef5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
6 changes: 3 additions & 3 deletions napari_sentinel_zip/_tests/test_napari_sentinel_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@


IM_SHAPES = [
(1000, 1000, 3), #QKL
(5490, 5490),
(5490, 5490),
(10980, 10980),
Expand All @@ -33,8 +34,7 @@
(5490, 5490),
(5490, 5490),
(10980, 10980),
(5490, 5490),
(1000, 1000, 3) #QKL
(5490, 5490)
]


Expand All @@ -43,7 +43,7 @@ def check_layer_list_structure(layer_list, num_ims, num_layers):
assert isinstance(layer_list, list), "reader does not return list"

# layer list must have expected number of layers
assert len(layer_list) == num_layers, f"Layer list has {len(layer_list)} layers, expected {NUM_LAYERS}"
assert len(layer_list) == num_layers, f"Layer list has {len(layer_list)} layers, expected {num_layers}"

for i in range(len(layer_list)):
layer = layer_list[i]
Expand Down
47 changes: 24 additions & 23 deletions napari_sentinel_zip/napari_sentinel_zip.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.0.1'
__version__ = '0.1.1'

"""
This module stacks and loads Sentinel ZIP images into napari.
Expand Down Expand Up @@ -193,7 +193,7 @@ def reader_function(path):
open_jpg = zip_obj.open(path)
image = imread(open_jpg)
jpg_stack.append(image)
images['QKL_ALL'] = da.stack(jpg_stack)
jpg_im = da.stack(jpg_stack)

# decide on colourmap
colormaps = defaultdict(lambda: 'gray')
Expand All @@ -208,29 +208,30 @@ def reader_function(path):

layer_list = []
layer_type = "image"
add_kwargs = {
"name": 'QKL_ALL',
"multiscale": False,
"scale": QKL_SCALE,
"rgb": True,
"visible": True,
"contrast_limits": CONTRAST_LIMITS
}
layer_list.append((jpg_im, add_kwargs, layer_type))

for band, image in images.items():
if band != "QKL_ALL":
colormap = colormaps[band]
blending = 'additive' if colormaps[band] != 'gray' else 'translucent'
add_kwargs = {
"name": band,
"multiscale": False,
"scale": SCALES[band],
"colormap": colormap,
"blending": blending,
"visible": False,
"contrast_limits": CONTRAST_LIMITS
}
else:
add_kwargs = {
"name": band,
"multiscale": False,
"scale": QKL_SCALE,
"rgb": True,
"visible": True,
"contrast_limits": CONTRAST_LIMITS
}
colormap = colormaps[band]
blending = 'additive' if colormaps[band] != 'gray' else 'translucent'
add_kwargs = {
"name": band,
"multiscale": False,
"scale": SCALES[band],
"colormap": colormap,
"blending": blending,
"visible": False,
"contrast_limits": CONTRAST_LIMITS
}
layer_list.append((image, add_kwargs, layer_type))

return layer_list


2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def read(fname):

setup(
name='napari-sentinel-zip',
version='0.0.1',
version='0.1.1',
author='Draga Doncila Pop',
author_email='[email protected]',
license='MIT',
Expand Down

0 comments on commit df33ef5

Please sign in to comment.