Diff of /code/DMACS.py [000000] .. [32d261]

Switch to unified view

a b/code/DMACS.py
1
import time
2
import numpy as np, nibabel as nib, pandas as pd
3
import tensorflow as tf
4
from deepseg import *
5
from p1processing import *
6
from p2processing import *
7
from meshfitting import *
8
from motionEstimation import *
9
from decimation import *
10
11
""" Deployment parameters """
12
FLAGS = tf.app.flags.FLAGS
13
#tf.app.flags.DEFINE_integer('coreNo', 3, 'Number of CPUs.')
14
#tf.app.flags.DEFINE_string('test_dir', '/vol/medic02/users/jduan/New_BRIDGE_Cases4',
15
#                           'Path to the test set directory, under which images are organised in '
16
#                           'subdirectories for each subject.')
17
#tf.app.flags.DEFINE_string('model_path', '/vol/medic02/users/jduan/HHData/tensorflowFCNCodes/DeepRegionEdgeSegmentation'
18
#                           '/saver/model/vgg_RE_network/vgg_RE_network.ckpt-50000', 'Path to the saved trained model.')
19
#tf.app.flags.DEFINE_string('atlas_dir', '/vol/medic02/users/jduan/HHData/3Dshapes_new', 'Path to the atlas.')
20
#tf.app.flags.DEFINE_string('param_dir', '/vol/medic02/users/jduan/myPatchMatch/par', 'Path to the registration parameters.')
21
#tf.app.flags.DEFINE_string('template_dir', '/vol/medic02/users/jduan/myPatchMatch/template_wenzhe', 'Path to the template.')
22
#tf.app.flags.DEFINE_string('template_PH', '/vol/medic02/users/jduan/myPatchMatch/vtks', 'Path to the template.')
23
24
25
26
tf.app.flags.DEFINE_integer('coreNo', 8, 'Number of CPUs.')
27
tf.app.flags.DEFINE_string('test_dir', '/data',
28
                           'Path to the test set directory, under which images are organised in '
29
                           'subdirectories for each subject.')
30
tf.app.flags.DEFINE_string('model_path',  '/model/vgg_RE_network.ckpt-50000', 'Path to the saved trained model.')
31
tf.app.flags.DEFINE_string('atlas_dir',  '/refs', 'Path to the atlas.')
32
tf.app.flags.DEFINE_string('param_dir', '/par', 'Path to the registration parameters.')
33
tf.app.flags.DEFINE_string('template_dir', '/vtks/1', 'Path to the template.')
34
tf.app.flags.DEFINE_string('template_PH', '/vtks/2', 'Path to the template.')
35
tf.app.flags.DEFINE_boolean('irtk', True, 'use irtk or not')
36
37
if __name__ == '__main__':
38
    
39
        print('Start evaluating on the test set ...')
40
        table_time = []
41
        start_time = time.time()
42
43
        deeplearningseg(FLAGS.model_path, FLAGS.test_dir, FLAGS.atlas_dir)
44
                 
45
        # multiatlasreg2D(FLAGS.test_dir, FLAGS.atlas_dir, FLAGS.param_dir, FLAGS.coreNo, True, FLAGS.irtk) # parallel, irtk
46
47
        multiatlasreg3D(FLAGS.test_dir, FLAGS.atlas_dir, FLAGS.param_dir, FLAGS.coreNo, True, FLAGS.irtk) # parallel, irtk
48
49
        meshCoregstration(FLAGS.test_dir, FLAGS.param_dir, FLAGS.template_dir, FLAGS.coreNo, True, False) # parallel, irtk
50
51
        motionTracking(FLAGS.test_dir, FLAGS.param_dir, FLAGS.template_PH, FLAGS.coreNo, True) # parallel
52
        
53
        decimate(FLAGS.test_dir, FLAGS.coreNo, False) 
54
55
        process_time = time.time() - start_time 
56
        print('Including image I/O, CUDA resource allocation, '
57
              'it took {:.3f}s in total for processing all the subjects).'.format(process_time))