Page 3 of 4

Re: Uploading from MATLAB

PostPosted: Mon Mar 19, 2012 3:11 pm
by jburel
Hi

Images cannot be linked to a project. If you specify a value target e.g. dataset Id = 5, the image will be imported in the dataset with id 5. The savedProject target was used by the deprecated Importer client to store preferences i.e. display the previously selected project/dataset the next time you log in, but it is not taken into account during the import process.
Those field should be removed to avoid confusion.

Jmarie

Re: Uploading from MATLAB

PostPosted: Mon Mar 19, 2012 4:49 pm
by JakeNewman
So are you saying that there is no way to upload an image into a specified project using an ImportConfig?

Re: Uploading from MATLAB

PostPosted: Tue Mar 20, 2012 8:00 am
by jmoore
Hi Jake,

you need to choose a dataset which is in the project you intended.

Cheers,
~Josh

Re: Uploading from MATLAB

PostPosted: Tue Mar 20, 2012 10:16 am
by JakeNewman
I believe that's what I'm doing with the following code. I'll have a play around with it some more, but any help would be gratefully received!

Jake

Code: Select all
config = ome.formats.importer.ImportConfig;
config.email.set('');
config.sendFiles.set(true);
config.sendReport.set(false);
config.contOnError.set(false);
config.debug.set(false);
config.hostname.set(get(data.servertext,'String'));
port = javaObject('java.lang.Integer',str2num(get(data.porttext,'String')));
config.port.set(port);
config.username.set(get(data.usernametext,'String'));
config.password.set(get(data.passwordtext,'String'));
config.targetClass.set('omero.model.Dataset');
groupID = javaObject('java.lang.Long',53);
config.group.set(groupID);
projectID = javaObject('java.lang.Long',804);
config.savedProject.set(projectID);
dataID = javaObject('java.lang.Long',908);
config.targetId.set(dataID);

store = config.createStore();

reader = ome.formats.importer.OMEROWrapper(config);
library = ome.formats.importer.ImportLibrary(store, reader);
handler = ome.formats.importer.cli.ErrorHandler(config);

paths{1} = TARGET;
candidates = ome.formats.importer.ImportCandidates(reader, paths, handler);

success = library.importCandidates(config, candidates);
store.logout();

Re: Uploading from MATLAB

PostPosted: Tue Mar 20, 2012 10:35 am
by jburel
Hi Jake

Your image should be imported in the dataset with id = 908, assuming that the dataset is in group 53.
The "save project" flag will only be used by the old importer client when building the UI.

Jmarie

Re: Uploading from MATLAB

PostPosted: Mon Jul 02, 2012 12:14 pm
by ihs7
Is there any way to grab the ID of newly imported image when uploading to OMERO through Matlab?

Code: Select all
Imported pixels:
4913


I know the ID of the last imported image is 4913 but is the ID somewhere stored in a variable?

Best regards,
Ívar

Re: Uploading from MATLAB

PostPosted: Mon Jul 02, 2012 11:06 pm
by jmoore
The CLI code uses an IObserver to list for IMPORT_DONE events. I've translated your example to pure Java which you can find at https://gist.github.com/3036255.

Alternatively, you can use ImportContainers directly as insight does. See https://github.com/openmicroscopy/openm ... java#L6296

Cheers,
~Josh

Re: Uploading from MATLAB

PostPosted: Fri Oct 26, 2012 1:29 pm
by dballvt
Has anyone gotten this to work? I've upgraded our OMERO instance to 4.4.4, and I've tried using the same code as before. It seems to be working properly until the call to

Code: Select all
success = library.importCandidates(config, candidates);


when i get the message:
[INFO] ImportLibrary - Exiting on error

but I can't figure out how to determine what the error was.
Thanks for any help!

Re: Uploading from MATLAB

PostPosted: Fri Oct 26, 2012 3:59 pm
by jmoore
Nothing else was printed before this INFO message?

Re: Uploading from MATLAB

PostPosted: Fri Oct 26, 2012 4:50 pm
by dballvt
yeah there was. There didn't seem to be any problems, but I guess I should have still included them. Here is the complete list of messages that I receive:

[INFO] ImportConfig - OMERO Version: 4.4.4-ice33-b3099
[INFO] ImportConfig - Bioformats version: 4.4.4 revision: 96c615b date: 25 September 2012
[INFO] OMEROMetadataStoreClient - Attempting initial SSL connection to gladden.vbi.vt.edu:4064
[INFO] OMEROMetadataStoreClient - Call context: {omero.group:3}
[INFO] OMEROMetadataStoreClient - Server: 4.4.4
[INFO] OMEROMetadataStoreClient - Client: 4.4.4-ice33-b3099
[INFO] OMEROMetadataStoreClient - Java Version: 1.6.0_35
[INFO] OMEROMetadataStoreClient - OS Name: Mac OS X
[INFO] OMEROMetadataStoreClient - OS Arch: x86_64
[INFO] OMEROMetadataStoreClient - OS Version: 10.8.2
[INFO] ImportCandidates - Depth: 4 Metadata Level: MINIMUM
[INFO] ImportCandidates - 1 file(s) parsed into 1 group(s) with 1 call(s) to setId in 36ms. (37ms total) [0 unknowns]
[INFO] OMEROMetadataStoreClient - Call context: {omero.group:3}
[INFO] OMEROMetadataStoreClient - Call context: {omero.group:3}
[INFO] ImportLibrary - Exiting on error