-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
name: Multi orientation | ||
description: A test multi file | ||
scale: | ||
mm_x: 0.0005 | ||
mm_y: 0.0005 | ||
sources: | ||
- path: . | ||
pathPattern: 'test_orient(?P<z1>[1-8])\.tif' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
name: Multi orientation | ||
description: A test multi file | ||
scale: | ||
mm_x: 0.0005 | ||
mm_y: 0.0005 | ||
width: 360 | ||
height: 360 | ||
sources: | ||
- name: First image | ||
path: ./test_orient1.tif | ||
z: 0 | ||
position: | ||
x: 0 | ||
y: 0 | ||
- path: ./test_orient2.tif | ||
z: 0 | ||
position: | ||
x: 180 | ||
y: 0 | ||
- path: ./test_orient3.tif | ||
z: 0 | ||
position: | ||
x: 0 | ||
y: 180 | ||
- path: ./test_orient4.tif | ||
z: 0 | ||
position: | ||
x: 180 | ||
y: 180 | ||
- path: ./test_orient5.tif | ||
z: 1 | ||
position: | ||
x: 0 | ||
y: 0 | ||
- path: ./test_orient6.tif | ||
z: 1 | ||
position: | ||
x: 180 | ||
y: 0 | ||
- path: ./test_orient7.tif | ||
z: 1 | ||
position: | ||
x: 0 | ||
y: 180 | ||
- path: ./test_orient8.tif | ||
z: 1 | ||
position: | ||
x: 180 | ||
y: 180 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
name: Multi orientation | ||
description: A test multi file | ||
scale: | ||
mm_x: 0.0005 | ||
mm_y: 0.0005 | ||
width: 2048 | ||
height: 1540 | ||
tileWidth: 256 | ||
tileHeight: 256 | ||
backgroundColor: | ||
- 0 | ||
- 0 | ||
- 255 | ||
sources: | ||
- path: ./test_orient1.tif | ||
z: 0 | ||
- path: ./test_orient2.tif | ||
z: 1 | ||
position: | ||
scale: 4 | ||
- path: ./test_orient3.tif | ||
z: 2 | ||
position: | ||
scale: 0.25 | ||
- path: ./test_orient4.tif | ||
z: 3 | ||
position: | ||
x: 137 | ||
y: 32 | ||
scale: 4 | ||
- path: ./test_orient5.tif | ||
z: 4 | ||
- path: ./test_orient6.tif | ||
z: 5 | ||
- path: ./test_orient7.tif | ||
z: 6 | ||
- path: ./test_orient8.tif | ||
z: 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import os | ||
|
||
import large_image_source_multi | ||
import pytest | ||
|
||
from . import utilities | ||
from .datastore import datastore | ||
|
||
|
||
@pytest.mark.parametrize('filename', [ | ||
'multi1.yml', | ||
'multi2.yml', | ||
'multi3.yml', | ||
]) | ||
def testTilesFromMulti(filename): | ||
testDir = os.path.dirname(os.path.realpath(__file__)) | ||
imagePath = os.path.join(testDir, 'test_files', filename) | ||
source = large_image_source_multi.open(imagePath) | ||
tileMetadata = source.getMetadata() | ||
assert tileMetadata['tileWidth'] == 64 | ||
assert tileMetadata['tileHeight'] == 64 | ||
assert tileMetadata['sizeX'] == 180 | ||
assert tileMetadata['sizeY'] == 180 | ||
assert tileMetadata['levels'] == 3 | ||
assert len(tileMetadata['frames']) == 8 | ||
|
||
utilities.checkTilesZXY(source, tileMetadata) | ||
|
||
|
||
def testTilesFromMultiComposite(): | ||
testDir = os.path.dirname(os.path.realpath(__file__)) | ||
imagePath = os.path.join(testDir, 'test_files', 'multi_composite.yml') | ||
source = large_image_source_multi.open(imagePath) | ||
tileMetadata = source.getMetadata() | ||
assert tileMetadata['tileWidth'] == 64 | ||
assert tileMetadata['tileHeight'] == 64 | ||
assert tileMetadata['sizeX'] == 360 | ||
assert tileMetadata['sizeY'] == 360 | ||
assert tileMetadata['levels'] == 4 | ||
assert len(tileMetadata['frames']) == 2 | ||
|
||
utilities.checkTilesZXY(source, tileMetadata) | ||
|
||
|
||
def testTilesFromMultiSimpleScaling(): | ||
testDir = os.path.dirname(os.path.realpath(__file__)) | ||
imagePath = os.path.join(testDir, 'test_files', 'multi_simple_scaling.yml') | ||
source = large_image_source_multi.open(imagePath) | ||
tileMetadata = source.getMetadata() | ||
assert tileMetadata['tileWidth'] == 256 | ||
assert tileMetadata['tileHeight'] == 256 | ||
assert tileMetadata['sizeX'] == 2048 | ||
assert tileMetadata['sizeY'] == 1540 | ||
assert tileMetadata['levels'] == 4 | ||
assert len(tileMetadata['frames']) == 8 | ||
|
||
for frame in range(len(tileMetadata['frames'])): | ||
utilities.checkTilesZXY(source, tileMetadata, tileParams={'frame': frame}) | ||
|
||
|
||
def testTilesFromMultiMultiSource(): | ||
imagePath = datastore.fetch('multi_source.yml') | ||
source = large_image_source_multi.open(imagePath) | ||
tileMetadata = source.getMetadata() | ||
assert tileMetadata['tileWidth'] == 256 | ||
assert tileMetadata['tileHeight'] == 256 | ||
assert tileMetadata['sizeX'] == 55988 | ||
assert tileMetadata['sizeY'] == 16256 | ||
assert tileMetadata['levels'] == 9 | ||
assert len(tileMetadata['frames']) == 300 | ||
|
||
utilities.checkTilesZXY(source, tileMetadata) | ||
utilities.checkTilesZXY(source, tileMetadata, tileParams={'frame': 50}) | ||
|
||
|
||
def testInternalMetadata(): | ||
imagePath = datastore.fetch('multi_source.yml') | ||
source = large_image_source_multi.open(imagePath) | ||
metadata = source.getInternalMetadata() | ||
assert 'frames' in metadata | ||
|
||
|
||
def testAssociatedImages(): | ||
imagePath = datastore.fetch('multi_source.yml') | ||
source = large_image_source_multi.open(imagePath) | ||
assert 'label' in source.getAssociatedImagesList() | ||
image, mimeType = source.getAssociatedImage('label') | ||
assert image[:len(utilities.JPEGHeader)] == utilities.JPEGHeader |