We're Hiring!

changing a plane of impored image

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.

changing a plane of impored image

Postby yossioulu » Thu Jan 14, 2016 10:34 am

Hi,
Is it possible to add a new plane to an existing image that was imported into a screen?
or
Is it possible to change the pixels content of a plane image that was imported into a screen?


I have a screen-plate-wells with images. Each image has 4 channels. I wrote some analysis that reads the 4 channels of each image and creates a new plane that I would like to add to that image.
I cannot find how to do it. The code I wrote in Java is:
Code: Select all
ImageData image = browse.getImage(ctx, imageId);
byteBuf = generate_new_plane_as_buffer(image);
store = gateway.createPixelsStore(ctx);
pixelsId = image.getDefaultPixels().getId();
store.setPixelsId(pixelsId, true);
store.setPlane(byteBuf, 0, 4, 0);
store.save();


I get exception:
serverExceptionClass = "ome.conditions.InternalException"
message = " Wrapped Exception: (java.lang.UnsupportedOperationException):
Cannot write to repository"
I also tried: store.setPlane(byteBuf, 0, 0, 0); // thinking I might be able to overwrite the content of an existing plane.. same error.

Any help/ ideas?
Thanks
yossioulu
 
Posts: 6
Joined: Thu Dec 03, 2015 6:59 pm

Re: changing a plane of impored image

Postby Dominik » Fri Jan 15, 2016 10:16 am

Hi,

that's not possible, it's not allowed to modify the original image data. But you could create a new image with the new plane. Depending on the purpose, either a single plane image or if you need to view the new plane together with the other planes, you would have to duplicate these planes from the original image. To keep track of the relations, you can also add a comment or description to the images containing this expression
Code: Select all
image id: 123
, this will create a clickable link referring to the image. That would be a way to "link" the images together.

Regards,
Dominik
User avatar
Dominik
Team Member
 
Posts: 149
Joined: Mon Feb 10, 2014 11:26 am

Re: changing a plane of impored image

Postby yossioulu » Sat Jan 16, 2016 10:19 am

Thanks for the reply.
The idea of adding a clickble lin is nice, but I tried adding the expression:
image id: 444
to the Comment of an image and also to the Description of an image (using the UI) and it did not create clickable object.
Is there a specific way of doing that?

I found that the text should be the full link to that image. Then it works fine.
e.g. http://localhost/webclient/?show=well-444
yossioulu
 
Posts: 6
Joined: Thu Dec 03, 2015 6:59 pm

Re: changing a plane of impored image

Postby yossioulu » Mon Jan 18, 2016 8:31 am

for the sake of others, I found a way to add my calculated image as another channel to an existing image in a well-screen.
What I do it the following, before importing the plate images to Omero, I edit the plate description file extension HTD and in it I changed the lines:
"NWavelengths", 4
"WaveName1", "wav1"
"WaveName2", "wav2"
"WaveName3", "wav3"
"WaveName4", "wav4"
"WaveCollect1", 1
"WaveCollect2", 1
"WaveCollect3", 1
"WaveCollect4", 1

to be:
"NWavelengths", 5
"WaveName1", "wav1"
"WaveName2", "wav2"
"WaveName3", "wav3"
"WaveName4", "wav4"
"WaveName5", "myNewWav"
"WaveCollect1", 1
"WaveCollect2", 1
"WaveCollect3", 1
"WaveCollect4", 1
"WaveCollect5", 1


Now I ran the import of that screen.
Although the image for the last channel is missing at that point the omero creates an empty slot for that 5th channel.
Now, in my script I'm calculating this new image and I save it with a proper name in the proper location under the ManagedRepository of Omero.
e.g. ./root_0/2016-01/11/09-05-32.275/MyPlateName_C05_s1_w5.tif

Once I do that I can see the image in the omero insight UI.
yossioulu
 
Posts: 6
Joined: Thu Dec 03, 2015 6:59 pm

Re: changing a plane of impored image

Postby Dominik » Mon Jan 18, 2016 8:45 am

That's an interesting way, thanks for sharing this. And yes, you're right, the "image id: " expression doesn't work for OMERO.web, it's Insight only (and it opens the referenced image in the image viewer, but does not navigate to it), I wasn't aware of this.

Regards,
Dominik
User avatar
Dominik
Team Member
 
Posts: 149
Joined: Mon Feb 10, 2014 11:26 am

Re: changing a plane of impored image

Postby jmoore » Mon Jan 18, 2016 10:59 am

NB: adding a channel after the fact should also work if that would simplify the workflow. ~Josh.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: changing a plane of impored image

Postby yossioulu » Wed Jan 20, 2016 6:30 pm

How do I add a channel to an existing image? (my image is in a plate within a screen)

Yes, my initial target is just to add a channel to the image. If this is possible without the above mentioned workaround, which now I'm starting to realize has issues and not sure that it actually working.
So if someone knows how to add a channel to an existing image in a screen, that will help a lot.

Thanks
Joe
yossioulu
 
Posts: 6
Joined: Thu Dec 03, 2015 6:59 pm

Re: changing a plane of impored image

Postby jmoore » Thu Jan 21, 2016 3:18 pm

Hi Joe,

in the process of writing up an example, I've realized you're still going to have to modify the file metadata after the fact. I'll finish up the integration test since other file formats might automatically pick up the changes, but if you have something working, you're probably in as good a state as you can be in.

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

Re: changing a plane of impored image

Postby yossioulu » Thu Jan 21, 2016 4:27 pm

Thanks for the reply. Unfortunately it looks like it was too early to celebrate. The omero does not show the image I created: ./root_0/2016-01/11/09-05-32.275/MyPlateName_C05_s1_w5.tif
What I did is not enough.
So I'm back in square one.
So if you think you might have something that can help please let me know.

Otherwise my next try is going to be create a new image which is a duplication of the image (e.g. C05) with all its fields images, channels and attachments and while in the duplication, create a new channel. then I can maybe delete the original image, save the new image and link it into the proper well.
I'm not that happy to do that, It seems to me lots of work and much of is is redundant.
There must be some way to add a channel to an existing image in a plate...

Thanks
Yossi
yossioulu
 
Posts: 6
Joined: Thu Dec 03, 2015 6:59 pm

Re: changing a plane of impored image

Postby jmoore » Thu Jan 21, 2016 6:55 pm

Understood. I'll keep working on my example then.

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


Return to Developer Discussion

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron