diff --git a/ShoulderCase/@Muscle/Muscle.m b/ShoulderCase/@Muscle/Muscle.m index c1baa6e..be2512d 100644 --- a/ShoulderCase/@Muscle/Muscle.m +++ b/ShoulderCase/@Muscle/Muscle.m @@ -1,65 +1,65 @@ 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); end function output = dataPath(obj) output = fullfile(obj.container.dataPath, obj.name); end function output = dataMaskPath(obj) output = fullfile(obj.dataPath, "mask"); 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; + output = logical(imread(fullfile(obj.dataMaskPath,... + obj.segmentationName+"_"+maskSuffix+".png"))); end - function output = saveMask(obj, mask, maskSuffix) - output = imwrite(fullfile(obj.dataMaskPath,... - obj.segmentationName+"_"+maskSuffix+".png")) > 0; + function saveMask(obj, mask, maskSuffix) + imwrite(mask, fullfile(obj.dataMaskPath,... + obj.segmentationName+"_"+maskSuffix+".png")); end function output = loadPixelCoordinates(obj) output = load(fullfile(obj.container.dataSlicesPath,... obj.sliceName + "_PixelCoordinates.mat")).imagesPixelCoordinates; end end end diff --git a/ShoulderCase/@Muscle/getMaskCoordinates.m b/ShoulderCase/@Muscle/getMaskCoordinates.m index ea9b992..4cb54c1 100644 --- a/ShoulderCase/@Muscle/getMaskCoordinates.m +++ b/ShoulderCase/@Muscle/getMaskCoordinates.m @@ -1,11 +1,11 @@ function output = getMaskCoordinates(obj, maskSuffix) mask = obj.loadMask(maskSuffix); [maskRow, maskColumn] = find(mask); slicePixelCoordinates = obj.loadPixelCoordinates(); maskCoordinates = []; for element = 1:length(maskRow) maskCoordinates = [maskCoordinates;... - pixelCoordinates{maskRow(element), maskColumn(element)}]; + slicePixelCoordinates{maskRow(element), maskColumn(element)}]; end output = maskCoordinates; end \ No newline at end of file