classdef Muscle < handle % The Muscle class is linked to a segmented muscle file (a mask) % and to the slice it has been segmented out of. % % Then, this class can measured values linked to the PCSA and the % muscle's degeneration. properties container = nan; name = ""; segmentationName = ""; sliceName = ""; PCSA = nan; atrophy = nan; fat = nan; osteochondroma = nan; degeneration = nan; forceApplicationPoint = nan; forceVector = nan; end methods function obj = Muscle(musclesContainer,muscleName) obj.container = musclesContainer; obj.name = muscleName; [~, ~] = mkdir(obj.dataPath); [~, ~] = mkdir(obj.dataMaskPath); [~, ~] = mkdir(obj.dataContourPath); end function output = dataPath(obj) output = fullfile(obj.container.dataPath, obj.name); end function output = dataMaskPath(obj) output = fullfile(obj.dataPath, "mask"); end function output = dataContourPath(obj) output = fullfile(obj.dataPath, "contour"); end function setSliceName(obj, value) obj.sliceName = value; end function setSegmentationName(obj, value) obj.segmentationName = value; end function output = loadMask(obj, maskSuffix) output = imread(fullfile(obj.dataMaskPath,... obj.segmentationName+"_"+maskSuffix+".png")) > 0; end function output = saveMask(obj, mask, maskSuffix) output = imwrite(fullfile(obj.dataMaskPath,... obj.segmentationName+"_"+maskSuffix+".png")) > 0; end function output = loadPixelCoordinates(obj) output = load(fullfile(obj.container.dataSlicesPath,... obj.sliceName + "_PixelCoordinates.mat")).imagesPixelCoordinates; end end end