



if isunix
    dirRootAosShare      = '/mnt/aos/AOSShare/';
else
    %dirRootAosShare      = 'A:/AOSShare/';
	dirRootAosShare       = '//dom1/AOS/AOSShare/';
end

% Load a test LAS File
performerCloudDir      = fullfile(dirRootAosShare, 'IARPA-CORE3D/SiteDataPackage/SanFernando/OpenSourceMVS/PCs_registered');
testModelFilename = fullfile(performerCloudDir, 'JHUAPL.las_adj.las');
testLAS = lasdata(testModelFilename);

% Load GeoTIFF metadata from truth DSM image
refDir                = fullfile(dirRootAosShare, 'SOCOM-3D-Data-Engineering/2016/160921-TEXPERT-Analysis/Data for Tests/SanFernando/50cm');
refDSMFilename        = fullfile(refDir,    'Master2.las_DSM.tif');
refDSMInfo            = geotiffinfo(refDSMFilename);
refDSMImg             = geotiffread(refDSMFilename);


% Align objective point cloud with reference image space
[row, col]   = map2pix(refDSMInfo.RefMatrix, testLAS.x, testLAS.y);

% Bin the test cloud to make DSM
outSize = [refDSMInfo.Height refDSMInfo.Width];
GRID_METHOD = 1; % Max
[testRaster, ~, N] = rasterData([col row], testLAS.z, outSize, [], GRID_METHOD);


figure(100);
ax1 = subplot(1,2,1); imagesc(refDSMImg); axis image; caxis([10 50])
ax2 = subplot(1,2,2);imagesc(testRaster); axis image
linkaxes([ax1 ax2])


