Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
script to compare features between CERR and pyradiomics
- Loading branch information
1 parent
2f8eb6d
commit 0b8afe7
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
% compareCerrWithPyrad.m | ||
% | ||
% Compares CERR and pyRaiomics features | ||
% | ||
% APA, 9/4/2019 | ||
|
||
pradParamFileName = 'C:\Users\aptea\Desktop\PyradParamsComparison.yaml'; | ||
cerrParamFileName = 'C:\Users\aptea\Desktop\CERR_ParamsComparison.json'; | ||
nrrdSaveDir = 'C:\Users\aptea\Desktop'; | ||
|
||
global planC | ||
indexS = planC{end}; | ||
|
||
structNum = 1; | ||
scanNum = getStructureAssociatedScan(structNum,planC); | ||
|
||
scan3M = double(planC{indexS.scan}(scanNum).scanArray) - planC{indexS.scan}(scanNum).scanInfo(1).CTOffset; | ||
mask3M = getUniformStr(structNum,planC); | ||
[xV, yV, zV] = getScanXYZVals(planC{indexS.scan}(1)); | ||
pixelspacing = [abs(mean(diff(xV))) abs(mean(diff(yV))) abs(mean(diff(zV)))]*10; | ||
origin = [0 0 0]; | ||
encoding = 'raw'; | ||
mask3M = cast(mask3M,'uint8'); | ||
% Write scan and mask to nrrd | ||
scanFilename = fullfile(nrrdSaveDir,'scan.nrrd'); | ||
maskFilename = fullfile(nrrdSaveDir,'mask.nrrd'); | ||
ok1 = nrrdWriter(scanFilename, scan3M, pixelspacing, origin, encoding); | ||
ok2 = nrrdWriter(maskFilename, mask3M, pixelspacing, origin, encoding); | ||
|
||
pyradCallStr = ['pyradiomics ', scanFilename, ' ', maskFilename, ' --param ', pradParamFileName]; | ||
system(pyradCallStr) | ||
|
||
delete(scanFilename) | ||
delete(maskFilename) | ||
|
||
% CERR radiomics | ||
paramS = getRadiomicsParamTemplate(cerrParamFileName); | ||
cerrFeatS = calcGlobalRadiomicsFeatures(scanNum, structNum, paramS, planC); | ||
cerrFeatS.Original.glcmFeatS.AvgS | ||
|
||
|