[ome-devel] adding Pixels to an existing Image...

Donald MacDonald donald at lifesci.dundee.ac.uk
Wed Aug 13 15:55:05 BST 2008


Hi Jerome,

I think that you've missed out creating the channels in the image.

You can see an example code to copy pixels in the iPixels Service.

**SNIP**

     /** Actually performs the work declared in {@link  
copyAndResizePixels()}. */
     private void _copyAndResizePixels(long pixelsId, Integer sizeX,
     		Integer sizeY, Integer sizeZ, Integer sizeT,
     		List<Integer> channelList, String methodology, boolean copyStats)
     {
         from = retrievePixDescription(pixelsId);
         to = new Pixels();

         // Ensure we have no values out of bounds
         outOfBoundsCheck(sizeX, "sizeX");
         outOfBoundsCheck(sizeY, "sizeY");
         outOfBoundsCheck(sizeZ, "sizeZ");
         outOfBoundsCheck(sizeT, "sizeT");

         // Check that the channels in the list are valid indexes.
         if(channelList!=null)
         	channelOutOfBounds(channelList, "channel", from);

         // Copy basic metadata
         to.setDimensionOrder(from.getDimensionOrder());
         to.setMethodology(methodology);
         to.setPixelsDimensions(from.getPixelsDimensions());
         to.setPixelsType(from.getPixelsType());
         to.setRelatedTo(from);
         to.setSizeX(sizeX != null? sizeX : from.getSizeX());
         to.setSizeY(sizeY != null? sizeY : from.getSizeY());
         to.setSizeZ(sizeZ != null? sizeZ : from.getSizeZ());
         to.setSizeT(sizeT != null? sizeT : from.getSizeT());
         to.setSizeC(channelList!= null ? channelList.size() :  
from.getSizeC());
         to.setSha1("Pending...");

         // Copy channel data, if the channel list is null copy all  
channels.
         // or copy the channels in the channelList if it's not null.
         if(channelList != null)
         {
         	for (Integer channel : channelList)
         	{
         		copyChannel(channel, from, to, copyStats);
         	}
         }
         else
         {
         	for (int channel = 0 ; channel < from.sizeOfChannels();  
channel++)
         	{
         		copyChannel(channel, from, to, copyStats);
         	}
         }
     }

** SNIP **

Another option is to use the new OMEROJava implementation to allow  
you connect from Matlab to OMERO. The only problem is that it  
requires you to have a
Blitz server Running.

https://trac.openmicroscopy.org.uk/omero/wiki/OMEROJava

This also has methods for copying, creating new pixels and images, +  
methods for uploading data to the new pixels.

Regards

Donald

On 13 Aug 2008, at 15:09, Jerome Avondo wrote:

> Hi,
>
> Firstly let me congratulate you on the OMERO Java API, I had a  
> little bit of experience using the older OME Java API, and I have  
> found that using this new API is a lot easier and lot less code to  
> write. Socongrats on the great work!
>
> Basically I have the following scenario. I am currently exploring  
> the use of the OMERO Java API from within Matlab to do some client  
> side image analysis.
>
> I would like to be able to from within Matlab, connect to the OMERO  
> server pull images off, do some processing and pack the results of  
> the processing as new Pixels in the original source Image. To do  
> this I am exposing some of the tasks we would like to do with my  
> own java class, basically just a simple layer sitting on top of the  
> OMERO Java API. This might not be the best/easiest way to do this,  
> so you might have some suggestions for a different approach... Any  
> suggestions/tips are always welcome...
>
> Anyways the problem I have is the code I have written seems to run  
> without errors but when I try to view the newly created Pixels  
> object from within OMERO.insight, it tells me that it is an invalid  
> image.
>
> I have attached my code in a file called test.java.
> I have also attached the OMERO.insight stack trace that I get when  
> trying to view my Pixels object, in a file called StackTrace.txt.
>
> If anyone could help understand what I am doing wrong I would be  
> very grateful.
>
> Also on a side note, could someone tell me what the function setSha1 
> ( ) of the Pixels object actually is?
>
> cheers,
>
> j.
>
> Get Hotmail on your mobile from Vodafone Try it Now! 
> <test.java><StackTrace.txt>
> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel



More information about the ome-devel mailing list