|
@@ -9,6 +9,8 @@ import numpy as np
|
|
|
import os
|
|
|
from PIL import Image
|
|
|
from skimage import img_as_ubyte
|
|
|
+from skimage.transform import resize
|
|
|
+from skimage.io import imsave
|
|
|
import time
|
|
|
from threading import Thread
|
|
|
|
|
@@ -85,13 +87,12 @@ def subvolumeCreator(volumeId, x, y, z, t, minWidth, sqrtZ, numberOfLayers, spri
|
|
|
logger.debug('layers per row: %d' % sqrtZ)
|
|
|
layerCounter = 0
|
|
|
copy_start_time = time.time()
|
|
|
- for index in range(z, z + numberOfLayers):
|
|
|
- zlayer = imageAsArray[index]
|
|
|
-
|
|
|
+ zArea = imageAsArray[z:z+numberOfLayers, :, :]
|
|
|
+ for index in range(0, numberOfLayers):
|
|
|
yoffset = math.floor(layerCounter / sqrtZ) * minWidth
|
|
|
xoffset = (layerCounter % sqrtZ) * minWidth
|
|
|
|
|
|
- subvolume[yoffset: yoffset+minWidth, xoffset: xoffset+minWidth] = zlayer[y: y+minWidth, x: x+minWidth]
|
|
|
+ subvolume[yoffset: yoffset+minWidth, xoffset: xoffset+minWidth] = zArea[index, y: y+minWidth, x: x+minWidth]
|
|
|
|
|
|
layerCounter += 1
|
|
|
|
|
@@ -100,9 +101,11 @@ def subvolumeCreator(volumeId, x, y, z, t, minWidth, sqrtZ, numberOfLayers, spri
|
|
|
subvolume = img_as_ubyte(subvolume)
|
|
|
image = Image.fromarray(subvolume)
|
|
|
image = image.resize(requestedShape, resample=Image.BILINEAR)
|
|
|
+ # subvolume = resize(subvolume, requestedShape)
|
|
|
format = spriteformat
|
|
|
buff = io.BytesIO()
|
|
|
image.save(buff, format=format, progressive=True, quality=95)
|
|
|
+ # imsave(buff, subvolume, pluginargs={'progressive':True, 'quality':95})
|
|
|
buff.seek(0, 0)
|
|
|
spriteFilename = get_sprite_filename(spriteId, spriteformat)
|
|
|
|
|
@@ -124,7 +127,8 @@ def subvolumeCreator(volumeId, x, y, z, t, minWidth, sqrtZ, numberOfLayers, spri
|
|
|
(x, y, z),
|
|
|
processing_duration,
|
|
|
copy_duration,
|
|
|
- imageAsArray.dtype
|
|
|
+ imageAsArray.dtype,
|
|
|
+ volumeId
|
|
|
)
|
|
|
else:
|
|
|
logger.debug('no testid given')
|