Thank you, Will and Mark. Appreciate the input.
>> You say that you have the actual file name saved as a Key/Value pair on each image? How is this populated?
>> Or do you mean the Original Metadata (under the Acquisition tab) that is coming from the file itself?
The key/value pairs are populated as part of our service as Omero annotations. So they are not in the original metadata of the file. But our service has access to them.
It would be sufficient to have the omero viewer show the original file name. Rather than using a script, I would like to do that in the same scala/java code that does the file importing.
One thing I noticed was that in the omero insight viewer, I can click the edit icon on the top right, and change the file name. Does the java api allow this? I tried to get a pointer to the Image object and set the name, with some code like this:
- Code: Select all
val imageObj = new ImageI(imageId, true)
imageObj.setName(originalFileName)
but OMERO threw a omero.gateway.exception.DSAccessException on saving the object:
- Code: Select all
"message": "Cannot access data. \nCannot update the object.",
"class": "omero.gateway.exception.DSAccessException",
"stack": [
"omero.gateway.facility.Facility.handleException(Facility.java:305)",
"omero.gateway.facility.DataManagerFacility.saveAndReturnObject(DataManagerFacility.java:344)",
"org.alleninstitute.ois.helpers.OmeroAPI.addKeyValue(OmeroAPI.scala:266)",
"org.alleninstitute.ois.helpers.OmeroAPI.$anonfun$inplaceImport$8(OmeroAPI.scala:83)",
"scala.runtime.java8.JFunction1$mcVI$sp.apply(JFunction1$mcVI$sp.java:12)",
"scala.collection.immutable.List.map(List.scala:272)",
"org.alleninstitute.ois.helpers.OmeroAPI.$anonfun$inplaceImport$7(OmeroAPI.scala:80)",
"scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:241)",
"scala.collection.immutable.List.foreach(List.scala:378)",
"scala.collection.TraversableLike.flatMap(TraversableLike.scala:241)",
"scala.collection.TraversableLike.flatMap$(TraversableLike.scala:238)",
"scala.collection.immutable.List.flatMap(List.scala:341)",
"org.alleninstitute.ois.helpers.OmeroAPI.$anonfun$inplaceImport$4(OmeroAPI.scala:78)",
"scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:241)",
"scala.collection.immutable.List.foreach(List.scala:378)",
"scala.collection.TraversableLike.flatMap(TraversableLike.scala:241)",
"scala.collection.TraversableLike.flatMap$(TraversableLike.scala:238)",
"scala.collection.immutable.List.flatMap(List.scala:341)",
"org.alleninstitute.ois.helpers.OmeroAPI.inplaceImport(OmeroAPI.scala:77)",
"org.alleninstitute.ois.helpers.InplaceImporter.importImage(InplaceImporter.scala:138)",
"org.alleninstitute.ois.helpers.InplaceImporter.$anonfun$importDataset$1(InplaceImporter.scala:262)",
"org.alleninstitute.ois.helpers.InplaceImporter.$anonfun$importDataset$1$adapted(InplaceImporter.scala:260)",
"scala.collection.immutable.List.foreach(List.scala:378)",
"org.alleninstitute.ois.helpers.InplaceImporter.importDataset(InplaceImporter.scala:260)",
"org.alleninstitute.ois.helpers.InplaceImporter.$anonfun$handleNonEmptyFieldList$2(InplaceImporter.scala:348)",
"scala.util.Success.$anonfun$map$1(Try.scala:251)",
"scala.util.Success.map(Try.scala:209)",
"scala.concurrent.Future.$anonfun$map$1(Future.scala:287)",
"scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)",
"scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)",
"org.uowlog.UOWFutureOnCompleteWrapper.$anonfun$apply$2(Continuity.scala:44)",
"org.uowlog.UnitOfWork.apply(UnitOfWork.scala:468)",
"org.uowlog.UOWFutureOnCompleteWrapper.apply(Continuity.scala:42)",
"scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)",
"scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:140)",
"java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)",
"java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)",
"java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)",
"java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)"
]
},
{
"message": "null",
"class": "omero.ValidationException",
"stack": [
"sun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeConstructorAccessorImpl.java)",
"sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)",
"sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)",
"java.lang.reflect.Constructor.newInstance(Constructor.java:423)",
"java.lang.Class.newInstance(Class.java:442)",
"IceInternal.BasicStream.createUserException(BasicStream.java:2779)",
"IceInternal.BasicStream.access$300(BasicStream.java:14)",
"IceInternal.BasicStream$EncapsDecoder10.throwException(BasicStream.java:3298)",
"IceInternal.BasicStream.throwException(BasicStream.java:2291)",
"IceInternal.OutgoingAsync.throwUserException(OutgoingAsync.java:399)",
"omero.api.IUpdatePrxHelper.end_saveAndReturnObject(IUpdatePrxHelper.java:927)",
"omero.api.IUpdatePrxHelper.saveAndReturnObject(IUpdatePrxHelper.java:805)",
"omero.api.IUpdatePrxHelper.saveAndReturnObject(IUpdatePrxHelper.java:792)",
"omero.gateway.facility.DataManagerFacility.saveAndReturnObject(DataManagerFacility.java:341)",
"org.alleninstitute.ois.helpers.OmeroAPI.addKeyValue(OmeroAPI.scala:266)",
"... omitting 36 common frames"
]
}
I was wondering if there is a different API to allow for this?