From ab7f9f553f71dfa9a75525ec0d5ae2eb16ea789c Mon Sep 17 00:00:00 2001 From: Johan Mathe Date: Mon, 21 Jan 2019 12:15:59 -0800 Subject: [PATCH 1/3] Update CMakeLists.txt --- 3rd_party_software/pyca/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rd_party_software/pyca/CMakeLists.txt b/3rd_party_software/pyca/CMakeLists.txt index 163d7b5..c5fc5f5 100644 --- a/3rd_party_software/pyca/CMakeLists.txt +++ b/3rd_party_software/pyca/CMakeLists.txt @@ -411,7 +411,7 @@ IF(USE_CUDA) MARK_AS_ADVANCED(CUDA_ARCH_VERSION) SET(CUDA_ARCH_VERSION - "13" + "30" CACHE STRING "Cuda architecture version, ie -arch sm_??") From d81bff31f7eaa4b139c9975da0f13d88379749cb Mon Sep 17 00:00:00 2001 From: Johan Mathe Date: Mon, 21 Jan 2019 13:07:18 -0800 Subject: [PATCH 2/3] Update usage_stats.i --- 3rd_party_software/pyca/Code/SWIG/usage_stats.i | 1 - 1 file changed, 1 deletion(-) diff --git a/3rd_party_software/pyca/Code/SWIG/usage_stats.i b/3rd_party_software/pyca/Code/SWIG/usage_stats.i index 47d0b63..9a666d3 100644 --- a/3rd_party_software/pyca/Code/SWIG/usage_stats.i +++ b/3rd_party_software/pyca/Code/SWIG/usage_stats.i @@ -58,7 +58,6 @@ The PyCA team if msg is not None: print "Thank you for helping PyCA development" - # save this information locally in _statfile with open(_statfile, 'w') as f: f.write(msg) From f774718902f90d7846f25cafc3e47a26b4c153d0 Mon Sep 17 00:00:00 2001 From: Johan Mathe Date: Mon, 21 Jan 2019 18:16:16 -0800 Subject: [PATCH 3/3] Update qs predict for functional api --- code/applications/qs_predict.py | 35 ++++++++++++++------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/code/applications/qs_predict.py b/code/applications/qs_predict.py index 01f9140..eec715d 100644 --- a/code/applications/qs_predict.py +++ b/code/applications/qs_predict.py @@ -96,7 +96,7 @@ def create_net(args, network_config): net = torch.nn.DataParallel(net_single, device_ids=device_ids).cuda() else: net = net_single - + net.train() return net; #enddef @@ -122,7 +122,7 @@ def write_result(result, output_prefix): #perform deformation prediction -def predict_image(args): +def predict_image(args, moving_images, target_images, output_prefixes): if (args.use_CPU_for_shooting): mType = ca.MEM_HOST else: @@ -144,29 +144,29 @@ def predict_image(args): correction_net = None; # start prediction - for i in range(0, len(args.moving_image)): + for i in range(0, len(moving_images)): - common.Mkdir_p(os.path.dirname(args.output_prefix[i])) + common.Mkdir_p(os.path.dirname(output_prefixes[i])) if (args.affine_align): # Perform affine registration to both moving and target image to the ICBM152 atlas space. # Registration is done using Niftireg. call(["reg_aladin", "-noSym", "-speeeeed", "-ref", args.atlas , - "-flo", args.moving_image[i], - "-res", args.output_prefix[i]+"moving_affine.nii", - "-aff", args.output_prefix[i]+'moving_affine_transform.txt']) + "-flo", moving_images[i], + "-res", output_prefixes[i]+"moving_affine.nii", + "-aff", output_prefixes[i]+'moving_affine_transform.txt']) call(["reg_aladin", "-noSym", "-speeeeed" ,"-ref", args.atlas , - "-flo", args.target_image[i], - "-res", args.output_prefix[i]+"target_affine.nii", - "-aff", args.output_prefix[i]+'target_affine_transform.txt']) + "-flo", target_images[i], + "-res", output_prefixes[i]+"target_affine.nii", + "-aff", output_prefixes[i]+'target_affine_transform.txt']) - moving_image = common.LoadITKImage(args.output_prefix[i]+"moving_affine.nii", mType) - target_image = common.LoadITKImage(args.output_prefix[i]+"target_affine.nii", mType) + moving_image = common.LoadITKImage(output_prefixes[i]+"moving_affine.nii", mType) + target_image = common.LoadITKImage(output_prefixes[i]+"target_affine.nii", mType) else: - moving_image = common.LoadITKImage(args.moving_image[i], mType) - target_image = common.LoadITKImage(args.target_image[i], mType) + moving_image = common.LoadITKImage(moving_images[i], mType) + target_image = common.LoadITKImage(target_images[i], mType) #preprocessing of the image moving_image_np = preprocess_image(moving_image, args.histeq); @@ -207,11 +207,6 @@ def predict_image(args): #endif - write_result(registration_result, args.output_prefix[i]); + write_result(registration_result, output_prefixes[i]); #enddef - - -if __name__ == '__main__': - check_args(args); - predict_image(args)