Browse Source

changed teststructure

Felix Schultze 9 years ago
parent
commit
6bb2ab9cbc

+ 3 - 2
loadtests/facade.py

@@ -1,6 +1,7 @@
 from .testmodels import TestRun
 
 
-def addTestResult(testId, inputShape, subvolumeShape, pointAsTuple, durationInSec, duration_copy_in_sec, dtype):
+def addTestResult(testId, inputShape, subvolumeShape, pointAsTuple, durationInSec, duration_copy_in_sec, dtype, volume_id=''):
+    ''' add a test result at once to the testId '''
     test = TestRun.objects(id=testId).first()
-    test.addTestResult(inputShape, subvolumeShape, pointAsTuple, durationInSec, duration_copy_in_sec, dtype)
+    test.addTestResult(inputShape, subvolumeShape, pointAsTuple, durationInSec, duration_copy_in_sec, dtype, str(volume_id))

+ 18 - 1
loadtests/testmodels.py

@@ -17,6 +17,7 @@ class Result(EmbeddedDocument):
     duration_copy_in_sec = FloatField()
     point = EmbeddedDocumentField(Dim)
     itemsize = IntField()
+    volume_id = StringField()
 
     @property
     def get_copy_throughput(self):
@@ -27,16 +28,28 @@ class Result(EmbeddedDocument):
 
         return number_of_items / self.duration_copy_in_sec / 1024 / 1024
 
+    @property
+    def volume_name(self):
+        if self.volumeId is None:
+            return ''
+
+        volumes = Volume.objects(id=self.volumeId)
+
+        if volumes is None:
+            return self.volumeId
+        else:
+            return volumes.first().name
 
 class TestRun(Document):
     name = StringField()
+    # for compatibilityreasons, it's left in here
     volumeId = StringField()
     results = ListField(EmbeddedDocumentField(Result))
     created = DateTimeField()
 
     meta = {"db_alias": "test_results"}
 
-    def addTestResult(self, originalShape, subvolumeShape, subvolumePoint, durationInSec, duration_copy_in_sec, dtype):
+    def addTestResult(self, originalShape, subvolumeShape, subvolumePoint, durationInSec, duration_copy_in_sec, dtype, volume_id):
         result = Result()
 
         inputSize = Dim()
@@ -54,11 +67,15 @@ class TestRun(Document):
         result.durationInSec = durationInSec
         result.duration_copy_in_sec = duration_copy_in_sec
         result.itemsize = dtype.itemsize
+        result.volume_id = volume_id
 
         TestRun.objects(id=self.id).update_one(push__results=result)
 
     @property
     def volume_name(self):
+        if self.volumeId is None:
+            return ''
+
         volumes = Volume.objects(id=self.volumeId)
 
         if volumes is None:

+ 1 - 1
loadtests/urls.py

@@ -7,7 +7,7 @@ from . import views
 urlpatterns = patterns(
     '',
     url(r'^$', views.index, name='home'),
-    url(r'^init/(?P<volumeId>[\da-z]+)/(?P<testName>[\da-z+*_/%]+)/$', views.testsetup),
+    url(r'^init/(?P<testName>[\da-z+*_/%]+)/$', views.testsetup),
     url(r'^delete/(?P<id>[\da-z]+)/$', views.deletetest, name='delete'),
     url(r'^csv/(?P<id>[\da-z]+)/$', views.createcsv, name='createcsv')
 )

+ 1 - 2
loadtests/views.py

@@ -20,10 +20,9 @@ def index(request):
     return render(request, 'loadtests/index.html', {'tests': tests})
 
 
-def testsetup(request, volumeId, testName):
+def testsetup(request, testName):
     test = TestRun()
     test.name = testName
-    test.volumeId = volumeId
     test.created = datetime.now()
     test = test.save()
     response = HttpResponse('{ "testId": ' + str(test.id) + ' }', content_type='json')

File diff suppressed because it is too large
+ 1 - 1
static/js/threeJsHelper/dist/threeJsHelper.min.js


+ 9 - 5
volumes/processing/service/SubvolumeCreator.py

@@ -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')

+ 5 - 4
volumes/views.py

@@ -105,10 +105,11 @@ def addList(request):
         volumesToProcess = []
 
         for path in paths:
-            pathParts = path.split('/')
+            pathParts = path.split(':')
+
             volume = Volume()
-            volume.name = pathParts[5] + '_____' + pathParts[7]
-            volume.path = path.strip()
+            volume.name = pathParts[0].strip()
+            volume.path = pathParts[1].strip()
             volume.imageSequence = imageSequences
             volume = volume.save()
             volumesToProcess.append(volume.id)
@@ -206,7 +207,7 @@ def render3D(request, id, res=None):
     if res is not None:
         res = int(res)
 
-    SubvolumeCreator.preread_volume(id)
+    #SubvolumeCreator.preread_volume(id)
 
     requestedResFound = False
     sizes = []

Some files were not shown because too many files changed in this diff