We're Hiring!

Uploading from MATLAB

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Re: Uploading from MATLAB

Postby jburel » Mon Mar 19, 2012 3:11 pm

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
User avatar
jburel
Team Member
 
Posts: 348
Joined: Thu May 21, 2009 6:38 pm
Location: dundee

Re: Uploading from MATLAB

Postby JakeNewman » Mon Mar 19, 2012 4:49 pm

So are you saying that there is no way to upload an image into a specified project using an ImportConfig?
JakeNewman
 
Posts: 12
Joined: Mon Jan 16, 2012 12:11 pm

Re: Uploading from MATLAB

Postby jmoore » Tue Mar 20, 2012 8:00 am

Hi Jake,

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

Cheers,
~Josh
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Uploading from MATLAB

Postby JakeNewman » Tue Mar 20, 2012 10:16 am

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();
JakeNewman
 
Posts: 12
Joined: Mon Jan 16, 2012 12:11 pm

Re: Uploading from MATLAB

Postby jburel » Tue Mar 20, 2012 10:35 am

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
User avatar
jburel
Team Member
 
Posts: 348
Joined: Thu May 21, 2009 6:38 pm
Location: dundee

Re: Uploading from MATLAB

Postby ihs7 » Mon Jul 02, 2012 12:14 pm

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
ihs7
 
Posts: 8
Joined: Wed May 30, 2012 12:56 pm

Re: Uploading from MATLAB

Postby jmoore » Mon Jul 02, 2012 11:06 pm

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
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Uploading from MATLAB

Postby dballvt » Fri Oct 26, 2012 1:29 pm

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!
dballvt
 
Posts: 24
Joined: Wed Jul 14, 2010 1:45 pm

Re: Uploading from MATLAB

Postby jmoore » Fri Oct 26, 2012 3:59 pm

Nothing else was printed before this INFO message?
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Uploading from MATLAB

Postby dballvt » Fri Oct 26, 2012 4:50 pm

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
dballvt
 
Posts: 24
Joined: Wed Jul 14, 2010 1:45 pm

PreviousNext

Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 0 guests