@@ -266,6 +266,32 @@ def test_SUBFUNCTIONS_RESIZE_postprocessing(self):
266
266
else : old_shape = (16 ,16 ,16 )
267
267
self .assertEqual (pred .shape , old_shape )
268
268
269
+ def test_SUBFUNCTIONS_RESIZE_postprocessing_activationOutput (self ):
270
+ # Test for 2D and 3D
271
+ for dim in ["2D" , "3D" ]:
272
+ # Initialize Subfunction
273
+ if dim == "2D" : new_shape = (7 ,7 )
274
+ else : new_shape = (7 ,7 ,7 )
275
+ sf = Resize (new_shape = new_shape )
276
+ # Create sample objects
277
+ sample_pred = deepcopy (getattr (self , "sample" + dim ))
278
+ sample_train = deepcopy (getattr (self , "sample" + dim + "seg" ))
279
+ # Run preprocessing of the subfunction
280
+ sf .preprocessing (sample_train , training = True )
281
+ sf .preprocessing (sample_pred , training = False )
282
+ # Transform segmentation data to simulate prediction data
283
+ if dim == "2D" :
284
+ sample_pred .pred_data = np .random .rand (16 , 16 , 3 )
285
+ else :
286
+ sample_pred .pred_data = np .random .rand (16 , 16 , 16 , 3 )
287
+ # Run postprocessing of the subfunction
288
+ pred = sf .postprocessing (sample_pred , sample_pred .pred_data ,
289
+ activation_output = True )
290
+ # Check for correctness
291
+ if dim == "2D" : old_shape = (16 ,16 ,3 )
292
+ else : old_shape = (16 ,16 ,16 ,3 )
293
+ self .assertEqual (pred .shape , old_shape )
294
+
269
295
#-------------------------------------------------#
270
296
# Resampling #
271
297
#-------------------------------------------------#
@@ -327,8 +353,6 @@ def test_SUBFUNCTIONS_RESAMPLING_postprocessing(self):
327
353
def test_SUBFUNCTIONS_RESAMPLING_postprocessing_activationOutput (self ):
328
354
# Test for 2D and 3D
329
355
for dim in ["2D" , "3D" ]:
330
- if dim == "2D" : continue
331
-
332
356
# Initialize Subfunction
333
357
if dim == "2D" : spacing = (1 ,1 )
334
358
else : spacing = (1 ,1 ,1 )
@@ -345,11 +369,12 @@ def test_SUBFUNCTIONS_RESAMPLING_postprocessing_activationOutput(self):
345
369
sf .preprocessing (sample_pred , training = False )
346
370
# Transform segmentation data to simulate prediction data
347
371
if dim == "2D" :
348
- sample_pred .pred_data = np .random .rand (16 , 16 , 3 ) * 3
372
+ sample_pred .pred_data = np .random .rand (16 , 16 , 3 )
349
373
else :
350
- sample_pred .pred_data = np .random .rand (16 , 16 , 16 , 3 ) * 3
374
+ sample_pred .pred_data = np .random .rand (16 , 16 , 16 , 3 )
351
375
# Run postprocessing of the subfunction
352
- pred = sf .postprocessing (sample_pred , sample_pred .pred_data )
376
+ pred = sf .postprocessing (sample_pred , sample_pred .pred_data ,
377
+ activation_output = True )
353
378
# Check for correctness
354
379
if dim == "2D" : old_shape = (16 ,16 ,3 )
355
380
else : old_shape = (16 ,16 ,16 ,3 )
0 commit comments