Page 2 of 4

Re: Uploading from MATLAB

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

Re: Uploading from MATLAB

PostPosted: Mon Mar 05, 2012 2:26 pm
by dballvt
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!

Re: Uploading from MATLAB

PostPosted: Mon Mar 05, 2012 2:35 pm
by jmoore
The main documentation for the library is on the wiki under "ImportLibrary". What are you looking for in particular?

~Josh

Re: Uploading from MATLAB

PostPosted: Mon Mar 05, 2012 5:40 pm
by dballvt
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.

Re: Uploading from MATLAB

PostPosted: Mon Mar 05, 2012 10:33 pm
by dballvt
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);

Re: Uploading from MATLAB

PostPosted: Tue Mar 06, 2012 2:25 pm
by jburel
Could you send us the entire code so it is easier to solve your problems?

Thanks
Jmarie

Re: Uploading from MATLAB

PostPosted: Tue Mar 06, 2012 5:20 pm
by dballvt
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!

Re: Uploading from MATLAB

PostPosted: Wed Mar 14, 2012 11:19 am
by jburel
Thanks for the code.
I will test it and add it to the matlab page

Jmarie

Re: Uploading from MATLAB

PostPosted: Wed Mar 14, 2012 3:44 pm
by dballvt
I still have the problem that I can't figure out how to specify the Project to which the images are uploaded.

Thanks

Re: Uploading from MATLAB

PostPosted: Thu Mar 15, 2012 5:03 pm
by JakeNewman
I have the same problem. I have specified the targetID in the config object but my uploaded tif ends up as an orphan.