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 jmoore » Sat Mar 03, 2012 8:36 am

dballvt wrote:Imported pixels:
1003


This certainly looks like everything was successful.

I checked on the server filesystem, and there is a file called 1003 in the pixels folder. However, the new image doesn't show up in the OMERO.insight GUI. When importing, I changed the dataset ID to the only dataset that we currently have in the database, so I don't understand why it doesn't show up. Does it have something to do with the fact that there is no metadata associated with it, yet?


It shouldn't be related to the metadata. Is it possible that the dataset and image are in a different group so that you aren't seeing it in Insight? Is it possible that the image didn't get correctly linked to the dataset and therefore the image is unlinked? Do you see it under the "Images" tab under "Projects", "Tags", etc.

Thanks for all of your help!!


Gladly.
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 » Mon Mar 05, 2012 2:26 pm

Ah, yes, it was put under a different group. Can you share a link to the API reference for the ImportLibrary? I've come across this one for OMERO, but I can't seem to find the reference for importing:

http://hudson.openmicroscopy.org.uk/job ... o/api.html

Thanks!
dballvt
 
Posts: 24
Joined: Wed Jul 14, 2010 1:45 pm

Re: Uploading from MATLAB

Postby jmoore » Mon Mar 05, 2012 2:35 pm

The main documentation for the library is on the wiki under "ImportLibrary". What are you looking for in particular?

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

Re: Uploading from MATLAB

Postby dballvt » Mon Mar 05, 2012 5:40 pm

I was particularly looking for how to change the group that the imported images would be associated with, but I also just wanted a reference for what other classes and methods are associated with the ImportLibrary, and ImportConfig in general. I think I've found the latter here:

http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/

And, I'll probably be able to figure out the former by looking though this documentation.
dballvt
 
Posts: 24
Joined: Wed Jul 14, 2010 1:45 pm

Re: Uploading from MATLAB

Postby dballvt » Mon Mar 05, 2012 10:33 pm

I figured out how to change the group using

Code: Select all
config.group.set(groupID);


Now the image appears in the correct group under Images in the left sidebar, but it still doesn't show up in the appropriate dataset . I tried setting the Project by using:

Code: Select all
config.savedProject.set(projectID);


That didn't seem to work, and I don't see any other fields associated with the Project. Am I just not specifying the dataset correctly? Here's how I did it, and using similar code seemed to work for changing the Group:

Code: Select all
dataID = javaObject('java.lang.Long',151);

config.targetId.set(dataID);
dballvt
 
Posts: 24
Joined: Wed Jul 14, 2010 1:45 pm

Re: Uploading from MATLAB

Postby jburel » Tue Mar 06, 2012 2:25 pm

Could you send us the entire code so it is easier to solve your problems?

Thanks
Jmarie
User avatar
jburel
Team Member
 
Posts: 348
Joined: Thu May 21, 2009 6:38 pm
Location: dundee

Re: Uploading from MATLAB

Postby dballvt » Tue Mar 06, 2012 5:20 pm

Sure, here it is:

Code: Select all
java.lang.System.setProperty('java.util.prefs.PreferencesFactory','java.util.prefs.MacOSXPreferencesFactory');
import loci.formats.in.DefaultMetadataOptions;
import loci.formats.in.MetadataLevel;
import ome.formats.OMEROMetadataStoreClient;
import ome.formats.importer.*
import ome.formats.importer.ImportConfig;
import ome.formats.importer.cli.ErrorHandler;
import ome.formats.importer.cli.LoggingImportMonitor;
import omero.model.Dataset;
loadOmero;
config = ImportConfig();
config.email.set('');
config.email.get
config.sendFiles.set('true');
config.sendReport.set('false');
config.contOnError.set('false');
config.debug.set('false');
config.hostname.set('sirion.vbi.vt.edu');

port = javaObject('java.lang.Integer',4064);
config.port.set(port);
config.username.set(uname);
config.password.set(pword);
config.targetClass.set('omero.model.Dataset');

dataID = javaObject('java.lang.Long',151);

config.targetId.set(dataID);

groupID = javaObject('java.lang.Long',3);
config.group.set(groupID);

projectID = javaObject('java.lang.Long',101);
config.savedProject.set(projectID);

paths2upload = '/Users/dballvt/Documents/Phase_t002.tif';

store = config.createStore();

store.logVersionInfo(config.getIniVersionNumber());
reader = OMEROWrapper(config);

library = ImportLibrary(store, reader);
handler = ErrorHandler(config);
library.addObserver(LoggingImportMonitor());
candidates = ImportCandidates(reader, paths2upload, handler);

reader.setMetadataOptions(DefaultMetadataOptions(MetadataLevel.ALL));

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

unloadOmero;

Thanks!
dballvt
 
Posts: 24
Joined: Wed Jul 14, 2010 1:45 pm

Re: Uploading from MATLAB

Postby jburel » Wed Mar 14, 2012 11:19 am

Thanks for the code.
I will test it and add it to the matlab page

Jmarie
User avatar
jburel
Team Member
 
Posts: 348
Joined: Thu May 21, 2009 6:38 pm
Location: dundee

Re: Uploading from MATLAB

Postby dballvt » Wed Mar 14, 2012 3:44 pm

I still have the problem that I can't figure out how to specify the Project to which the images are uploaded.

Thanks
dballvt
 
Posts: 24
Joined: Wed Jul 14, 2010 1:45 pm

Re: Uploading from MATLAB

Postby JakeNewman » Thu Mar 15, 2012 5:03 pm

I have the same problem. I have specified the targetID in the config object but my uploaded tif ends up as an orphan.
JakeNewman
 
Posts: 12
Joined: Mon Jan 16, 2012 12:11 pm

PreviousNext

Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 0 guests