Skip to content

Commit

Permalink
script to compare features between CERR and pyradiomics
Browse files Browse the repository at this point in the history
  • Loading branch information
adityaapte committed Sep 25, 2019
1 parent 2f8eb6d commit 0b8afe7
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Unit_Testing/tests_for_cerr/compareCerrWithPyrad.m
@@ -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


0 comments on commit 0b8afe7

Please sign in to comment.