We're Hiring!

retrieving image information from OMERO.web template page

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.

retrieving image information from OMERO.web template page

Postby bhcho » Thu Oct 13, 2011 2:24 pm

Hi all,

I'm trying to modify a template page in OMERO.web, especially \omeroweb\webclient\templates\webclient\data\containers_icon.html.
I added a custom button to execute my own app. After you select an image from the template page, then you can execute my own app for the selected image by clicking the custom button.

But before executing a custom app, I'd like to popup a dialog window to select channel, z-depth, and timepoint of the selected image.

I could get the image ID of the selected image by
Code: Select all
var productArray = $("input[type='checkbox']:checked");
if (productArray.length > 0 ) {
  productArray.each(function() {
    if(this.checked) {
      productListQuery += this.id + ",";
    }
  });
}


But is it possible to get the number of channel of the selected image (and the name of each channel if possible), the number of z, and the number of timepoint from this template page?

Best,
BK
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: retrieving image information from OMERO.web template pag

Postby wmoore » Thu Oct 13, 2011 2:37 pm

It seems that the 'dialog window' is really just the first page of your app, and you'd need to build that page in the same way as any other.

- Create a url that takes the imageId
- In views.py create a function that gets the Image object and the channel data
Code: Select all
image = conn.getObject("Image", imageId)
sizeZ = image.getSizeZ()
sizeT = image.getSizeT()

# or use getLabel() to show wavelength or index if no name
names = [c.getName() for c in image.getChannels()]

return render_to_response('your/dialog/template.html', {'sizeZ: sizeZ, 'sizeT':sizeT, 'names':names})


In fact, you could just return the image object itself and let the template do the rest,
E.g.
Code: Select all
return render_to_response('your/dialog/template.html', {'image': image})


Code: Select all
{% for c in image.getChannels %}
  <li>{{ c.getName }}</li>
{% endfor %}
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: retrieving image information from OMERO.web template pag

Postby bhcho » Thu Oct 13, 2011 2:50 pm

Thanks,

I was actually asking about a way to retrieve the information without using another app. (getting the information directly from the "$("input[type='checkbox']:checked")").
But I guess this is not possible.

BK
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: retrieving image information from OMERO.web template pag

Postby wmoore » Thu Oct 13, 2011 3:06 pm

I'm afraid not.

Also it makes for a cleaner integration if you have to add less code to the webclient itself.
Keeping it together with your app is nicer.

Will.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: retrieving image information from OMERO.web template pag

Postby bhcho » Fri Oct 14, 2011 2:45 pm

Thanks again Will,

Two more questions.

1.
Is the "Pixels" deprecated from 4.3.x version?
from 4.2.x version (when using Gateway, not Blitzgateway), I had to inherit Pixels first like..
Code: Select all
gateway = session.createGateway()
image = gateway.getImage( iid )
pixels = image.getPixels( 0 )
C = pixels.getSizeC()
T = pixels.getSizeT()
X = pixels.getSizeX()
Y = pixels.getSizeY()
Z = pixels.getSizeZ()

I thought "Image" can have multiple Pixels, and Pixels then have multiple Channels, Depth, and timepoints.

2.
what is the equivalent code for 4.2.x? I was using
Code: Select all
    image = conn.getImage(iid)
    Channels = image.getChannels()
    sizeC=len(Channels)
    sizeZ=image.getZ()
    sizeT=image.getT()


I can get the number of channels, but SizeZ and SizeT are zeros from this. I think these should be 1.

BK
Last edited by bhcho on Fri Oct 14, 2011 3:02 pm, edited 1 time in total.
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: retrieving image information from OMERO.web template pag

Postby wmoore » Fri Oct 14, 2011 3:01 pm

Hi BK,

We haven't got rid of Pixels, since that would be a massive model change. However, there are various places in our code where we assume Image only has one Pixels object.

The image.getSizeX() is really just a shortcut for image.getPrimaryPixels().getSizeX(). We just hide this from the user for convenience.

NB: I haven't tried using image.getPixels(0) but you should probably be using image.getPrimaryPixels() so that you get the correct PixelsWrapper object (E.g. for getting access to raw pixel data etc). Also, image.getPixels(0) will fail if the pixels are not already loaded, whereas image.getPrimaryPixels() loads pixels if needed.

Cheers,

Will.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm


Return to Developer Discussion

Who is online

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