diff --git a/ShoulderCase/@LandmarksExporter/LandmarksExporter.m b/ShoulderCase/@LandmarksExporter/LandmarksExporter.m index d020ba1..8344c23 100644 --- a/ShoulderCase/@LandmarksExporter/LandmarksExporter.m +++ b/ShoulderCase/@LandmarksExporter/LandmarksExporter.m @@ -1,17 +1,16 @@ classdef LandmarksExporter < handle properties (Access = private) - SCase + landmarks = []; end methods - function obj = LandmarksExporter(SCase) - obj.Scase = SCase; + function obj = LandmarksExporter() end end end \ No newline at end of file diff --git a/ShoulderCase/@LandmarksExporter/addLandmarks.m b/ShoulderCase/@LandmarksExporter/addLandmarks.m new file mode 100644 index 0000000..5ac9102 --- /dev/null +++ b/ShoulderCase/@LandmarksExporter/addLandmarks.m @@ -0,0 +1,3 @@ +function addLandmarks(obj,landmarks); + obj.landmarks = [obj.landmarks; landmarks]; +end \ No newline at end of file diff --git a/ShoulderCase/@LandmarksExporter/exportAmiraFile.m b/ShoulderCase/@LandmarksExporter/exportAmiraFile.m new file mode 100644 index 0000000..d96ce93 --- /dev/null +++ b/ShoulderCase/@LandmarksExporter/exportAmiraFile.m @@ -0,0 +1,5 @@ +function exportAmiraFile(obj,filepath,filename) + fid = fopen(fullfile(filepath,filename),'w'); + fprintf(fid,obj.getAmiraLandmarksFileWithCurrentLandmarks()); + fclose(fid); +end \ No newline at end of file diff --git a/ShoulderCase/@LandmarksExporter/getAmiraLandmarksFileWithCurrentLandmarks.m b/ShoulderCase/@LandmarksExporter/getAmiraLandmarksFileWithCurrentLandmarks.m new file mode 100644 index 0000000..a9cd885 --- /dev/null +++ b/ShoulderCase/@LandmarksExporter/getAmiraLandmarksFileWithCurrentLandmarks.m @@ -0,0 +1,13 @@ +function output = getAmiraLandmarksFileWithCurrentLandmarks(obj) + rawText = obj.getAmiraLandmarksRawFile(); + fileText = rawText; + for i = 1:size(obj.landmarks,1) + fileText = [fileText getTextFromPoint(obj.landmarks(i,:))]; + end + fileText = sprintf(fileText,size(obj.landmarks,1)); + output = fileText; +end + +function output = getTextFromPoint(landmark) + output = replace([num2str(landmark(1),'%10.15e') ' ' num2str(landmark(2),'%10.15e') ' ' num2str(landmark(3),'%10.15e') '\n'],'e+','e+0'); +end \ No newline at end of file diff --git a/ShoulderCase/@LandmarksExporter/getAmiraLandmarksFileWithPoints.m b/ShoulderCase/@LandmarksExporter/getAmiraLandmarksFileWithPoints.m deleted file mode 100644 index 242213d..0000000 --- a/ShoulderCase/@LandmarksExporter/getAmiraLandmarksFileWithPoints.m +++ /dev/null @@ -1,9 +0,0 @@ -function output = getAmiraLandmarksFileWithPoints(obj,points) - rawText = obj.getAmiraLandmarksRawFile(); - fileText = sprintf(rawText,size(points,1)); - for i = 1:size(points,1) - textFromPoint = replace([num2str(points(i,1),'%10.15e') ' ' num2str(points(i,2),'%10.15e') ' ' num2str(points(i,3),'%10.15e') '\n'],'e+','e+0'); - fileText = [fileText textFromPoint]; - end - output = fileText; -end \ No newline at end of file