diff --git a/loadSCase.m b/loadSCase.m index b9064e5..01814b9 100644 --- a/loadSCase.m +++ b/loadSCase.m @@ -1,21 +1,46 @@ function output = loadSCase(SCaseID) - % Load a ShoulderCase from the database + % Load ShoulderCase objects from the database % - % Inputs: id char of shoulder case (e.g. 'P315') + % Inputs: + % SCaseID: String array of shoulder case IDs. + % Including "N" in the string array will load all the normal cases. + % Including "P" in the string array will load all the pathological cases. + % Including "*" in the string array will load all the cases. % - % Output: Corresponding ShoulderCase object + % Output: + % Array of the corresponding ShoulderCase objects. % - % Example: SCasePlotter = plotSCase('P315'); + % Example: + % SCase = loadSCase("N29"); loads the N29 normal case. + % SCases = loadSCase(["N29" "N32"]); loads N29 and N32 normal cases. + % SCases = loadSCase(["N29" "N32" "N"]); loads all the normal cases. + % SCases = loadSCase(["N29" "N32" "N" "P"]); loads all the normal and + % pathological cases. + % SCases = loadSCase(["N29" "N32" "N" "P" "*"]); loads all the cases. % - addpath(genpath('ShoulderCase')); + SCaseID = string(SCaseID); + addpath(genpath('ShoulderCase')); database = ShoulderCaseLoader; - if isequal(SCaseID, "*") + if ismember("*", SCaseID) SCase = database.loadAllCases(); - else - SCase = database.loadCase(SCaseID); + output = SCase; + return + end + + if ismember("N", SCaseID) + SCaseID(ismember(SCaseID, "N")) = []; + SCaseID = [SCaseID string(database.getAllNormalCasesID)]; + SCaseID = unique(SCaseID); + end + if ismember("P", SCaseID) + SCaseID(ismember(SCaseID, "P")) = []; + SCaseID = [SCaseID string(database.getAllPathologicalCasesID)]; + SCaseID = unique(SCaseID); end + + SCase = database.loadCase(SCaseID); output = SCase; end \ No newline at end of file