Switch to unified view

a b/sandbox/test_predictions.py
1
import os
2
import numpy as np
3
import data_transforms
4
import pathfinder
5
import utils
6
import utils_lung
7
from configuration import set_configuration, config
8
from utils_plots import plot_2d_animation, plot_slice_3d_3
9
10
set_configuration('test_config')
11
12
13
def test_luna3d():
14
    # path = '/mnt/sda3/data/kaggle-lung/lunapred/luna_scan_v3_dice-20170131-173443/'
15
    path = '/mnt/sda3/data/kaggle-lung/lunapred_el/luna_scan_v3_dice-20170201-231707/'
16
    files = os.listdir(path)
17
    print files
18
    x, y, p = [], [], []
19
    for f in files:
20
        if 'in' in f:
21
            x.append(f)
22
        elif 'tgt' in f:
23
            y.append(f)
24
        else:
25
            p.append(f)
26
    x = sorted(x)
27
    y = sorted(y)
28
    p = sorted(p)
29
    for xf, yf, pf in zip(x, y, p):
30
        x_batch = utils.load_pkl(path + xf)
31
        pred_batch = utils.load_pkl(path + pf)
32
        y_batch = utils.load_pkl(path + yf)
33
        print xf
34
        print yf
35
        print pf
36
        # plot_2d_animation(x_batch[0], y_batch[0], pred_batch[0])
37
        plot_slice_3d_3(x_batch[0,0],y_batch[0,0],pred_batch[0,0],0,'aa')
38
39
40
41
if __name__ == '__main__':
42
    test_luna3d()