Skip to content

example to obtain scan values within an roi for the patient cohort

Aditya P. Apte edited this page Jan 11, 2023 · 2 revisions

Example to obtain scan values within an ROI for the cohort of patients

dirName = 'path/to/dir/containing/cerr/files';
strName = 'GTV';

dirS = dir(dirName);
dirS(1:2) = [];

% Initialize scan vector
scanV =[];

for i = 1:length(dirS)
    fname = dirS(i).name;
    
    fullFname = fullfile(dirName,fname);
    
    planC = loadPlanC(fullFname, tempdir);
    planC = updatePlanFields(planC);
    planC = quality_assure_planC(fullFname, planC);
        
    indexS = planC{end};    
    
    strC = {planC{indexS.structures}.structureName};
    
    structNum = getMatchingIndex(strName,strC,'exact');        
    
    scanNum = getStructureAssociatedScan(structNum , planC);
        
    % Get scan volume
    structMask3M = getStrMask(structNum,planC);
    scanArray3M  = getScanArray(planC{indexS.scan}(scanNum));
    scanArray3M  = double(scanArray3M) - planC{indexS.scan}(scanNum).scanInfo(1).CTOffset;    
    
    % add entry to the scan vector
    scanV = [scanV; scanArray3M(structMask3M)];

end
Clone this wiki locally