Skip to content
Brian Wandell edited this page Jun 21, 2016 · 7 revisions

Download an ISETBIO scene.

% Create the client
rd = RdtClient('isetbio');

% Change to the remote path
rd.crp('/resources/scenes/hyperspectral/stanford_database/fruit');

% List all the artifacts
a = rd.listArtifacts('type','mat');

%% Read the first artifact
sData = rd.readArtifact(a(1));
scene = sceneFromBasis(sData);

% Visualize the scene
ieAddObject(scene); sceneWindow;

Download a jpg image

rd.crp('/resources/scenes/hyperspectral/stanford_database/fruit');
rgb = rd.readArtifact('FreshFruit_Cx','type','jpg');
vcNewGraphWin; imshow(rgb);

Copy a remote file to a destination folder.

Normally, the repository copies files to a special place in your system and when you make a new request for the data the database checks if it is necessary to download. If the local copy matches the remote copy, then no new download takes place. The local data are read and returned.

In some cases, we find it necessary to load the remote file to a different place (say your working directory) so you can have a new copy. The ('destinationFolder', ) lets you do this. This was particularly important for cases in which the database had mangled the original file name and we wanted our own local copy without all the database intervention. We had particular problems with MRI.nii.gz files because of the double extensions.

This example illustrates saving a file in the working directory. The name of the file is the artifactId and the file type, "artifactId.type".

rd.crp('/resources/scenes/hyperspectral/stanford_database/fruit');
rd.readArtifact('FreshFruit_Cx','type','jpg','destinationFolder',pwd);
rgb = imread('FreshFruit_Cx.jpg');
vcNewGraphWin; imshow(rgb);

Copy a specific artifact

If you know the artifactId name, you can download it specifically. But you must still be in the proper remote path.

% We know the artifactId, so no listing and selecting
rd.crp('/resources/scenes/hyperspectral/stanford_database/fruit');
sData = rd.readArtifact('FreshFruit_Cx','type','mat');
scene = sceneFromBasis(sData);
ieAddObject(scene); sceneWindow;