% CONVERT_CJT_DATA_TO_VXL: conversion of image and points data from MATLAB to VXL 
%
%
%    GENERAL
%
%      
% Script to convert some of Carole Twining's data into VXL-readable form
% There are some hacks in the code below, including a re-implemnataion of
% u_savePTSfile to override the number of points
%
%    INPUT/S
%
%      -Omitted
%
%    OUTPUT/S
%
%      -Omitted
%
%    PENDING WORK
%
%      -
%
%    KNOWN BUG/S
%
%      -None.
%
%    COMMENT/S
%
%      -
%
%    RELATED FUNCTION/S
%
%      
%
%    ABOUT
%
%      -Created:     February 2005
%      -Last update: March 15th, 2005
%      -Revision:    0.0.1
%      -Author:      R. S. Schestowitz, University of Manchester
% ==============================================================

% open data

align = open('~/Model_Evaluation/Data/CT_10032005-masked.mat');

% generate pts files

for i=1:size(align.masked(1).x,2),
  u_savePTSfile(['points_',num2str(i),'.pts'],[align.masked(i).x;align.masked(i).y]');
end % save all sets of 2-D points in files

% generate images

for i=1:size(align.masked(1).x,2),
% with frame and display enabled:
%  figure = imshow(align.align(i).image, [0,255]);
%  saveas(figure,['image_',num2str(i),'.jpg'],'jpg');
  imwrite(align.masked(i).image/255, ['image_',num2str(i),'.jpg'],'jpg');
end