Skip to content

Commit

Permalink
Added an option to specify plastimatch build directory
Browse files Browse the repository at this point in the history
  • Loading branch information
adityaapte committed Dec 18, 2018
1 parent 6659379 commit 4851679
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CERR_core/CERROptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@

"ROISampleRate" : 1,

"DVHBinWidth" : 0.2,
"DVHBinWidth" : 0.1,

"DVHBlockSize" : 5000,

Expand Down Expand Up @@ -217,6 +217,7 @@
"sinc_filter_on_display" : 0,

"plastimatch_command_file" : "bspline_register_cmd_dir.txt",
"plastimatch_build_dir" : "~/software/plastimatch-build",

"linePoolSize" : 30,

Expand Down
11 changes: 11 additions & 0 deletions CERR_core/ImageRegistration/warp_dose.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
%
% APA, 07/19/2012

global stateS

indexMovS = movPlanC{end};
indexS = planC{end};

Expand All @@ -24,6 +26,12 @@
% Generate name for the output .mha file
warpedMhaFileName = fullfile(getCERRPath,'ImageRegistration','tmpFiles',['warped_dose_',baseScanUID,'_',movScanUID,'.mha']);

% Switch to plastimatch directory if it exists
prevDir = pwd;
if exist(stateS.optS.plastimatch_build_dir,'dir')
cd(stateS.optS.plastimatch_build_dir)
end

% Issue plastimatch warp command with nearest neighbor interpolation
%system(['plastimatch warp --input ', escapeSlashes(movDoseFileName), ' --output-img ', escapeSlashes(warpedMhaFileName), ' --xf ', escapeSlashes(bspFileName)])
system(['plastimatch warp --input ', movDoseFileName, ' --output-img ', warpedMhaFileName, ' --xf ', bspFileName])
Expand All @@ -41,3 +49,6 @@
delete(warpedMhaFileName)
delete(bspFileName)
end

% Switch back to the previous directory
cd(prevDir)
13 changes: 12 additions & 1 deletion CERR_core/ImageRegistration/warp_scan.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
%
% APA, 07/19/2012

global stateS

% Create b-spline coefficients file
if isstruct(deformS)
baseScanUID = deformS.baseScanUID;
Expand Down Expand Up @@ -31,6 +33,12 @@
% Generate name for the output .mha file
warpedMhaFileName = fullfile(getCERRPath,'ImageRegistration','tmpFiles',['warped_scan_',baseScanUID,'_',movScanUID,'.mha']);

% Switch to plastimatch directory if it exists
prevDir = pwd;
if exist(stateS.optS.plastimatch_build_dir,'dir')
cd(stateS.optS.plastimatch_build_dir)
end

% Issue plastimatch warp command
fail = system(['plastimatch warp --input ', movScanFileName, ' --output-img ', warpedMhaFileName, ' --xf ', bspFileName]);
if fail % try escaping slashes
Expand All @@ -50,4 +58,7 @@
end
delete(movScanFileName)
delete(warpedMhaFileName)
end
end

% Switch back to the previous directory
cd(prevDir)
11 changes: 11 additions & 0 deletions CERR_core/ImageRegistration/warp_structures.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
%
% APA, 07/20/2012

global stateS

indexMovS = movPlanC{end};

% Create b-spline coefficients file
Expand All @@ -20,6 +22,12 @@
baseScanUID = planC{indexS.scan}(strCreationScanNum).scanUID;
end

% Switch to plastimatch directory if it exists
prevDir = pwd;
if exist(stateS.optS.plastimatch_build_dir,'dir')
cd(stateS.optS.plastimatch_build_dir)
end

for structNum = movStructNumsV

% Convert structure mask to .mha
Expand Down Expand Up @@ -68,3 +76,6 @@
delete(bspFileName)
end
end

% Switch back to the previous directory
cd(prevDir)

0 comments on commit 4851679

Please sign in to comment.