The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
[SOLVED] How to save IOObject to repository
Hello,
I would like to save IOObjects from ImageProcessing extension to repository, but ImagePlus class, which is essential class in ImageProcessing IOObject, doesn't support serialization. How to serialize image is described in http://imagej.1557.n6.nabble.com/Re-ImagePlus-Serializable-td3681988.html. In AbstractIOObject is write() method, but it has final modifier so it can't be overridden.
Is there a way how to implement my own serialization and de-serialization method? Or is there other solution?
I greet and thank you for your answers.
Vaclav
I would like to save IOObjects from ImageProcessing extension to repository, but ImagePlus class, which is essential class in ImageProcessing IOObject, doesn't support serialization. How to serialize image is described in http://imagej.1557.n6.nabble.com/Re-ImagePlus-Serializable-td3681988.html. In AbstractIOObject is write() method, but it has final modifier so it can't be overridden.
Is there a way how to implement my own serialization and de-serialization method? Or is there other solution?
I greet and thank you for your answers.
Vaclav
Tagged:
0
Answers
I've never used it, but the Serializable interface JavaDoc says:
Classes that require special handling during the serialization and deserialization process must implement special methods with these exact signatures:
private void writeObject(java.io.ObjectOutputStream out)
throws IOException
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException;
private void readObjectNoData()
throws ObjectStreamException;
You could try to handle your special cases there.
Regards,
Marco
I know this method, but I would like to save an image to the repository by clicking on "Store this result in the repository." (highlighted in the picture) and I'm pretty sure that method writeObject(java.io.ObjectOutputStream out) will not be called.
So, is there any way to do this?
Thanks,
Vaclav
I hope that Simon could know answer to this problem
Thanks,
Vaclav
let's trace what happens when you click that button. See JavaDoc of method in step 9 which is a standard serialization method offered by Java. So it should indeed use your custom writeObject(ObjectOutputStream out) method and the other 2 I mentioned earlier. Did you try it and it did not work?
Regards,
Marco
thank you. Now I see, how it works.
Vaclav