[ome-devel] OMEIS Content header validity
Ilya Goldberg
igg at nih.gov
Wed Mar 1 18:56:37 GMT 2006
If you're hooked into OME, then you can simply look up the format
from OriginalFiles.Format.
You can match your file to the correct OriginalFile by using
OriginalFile.FileID which matches the OMEIS FileID (622 in your URL),
or even by matching SHA1 digests (OriginalFile.SHA1 == mySHA1). If
you match by FileID, make sure that
OriginalFile.Repository.ImageServerURL is the right URL for your
image server (.../cgi-bin/omeis in you example).
Still not sure of the context of your application, so all this might
be moot.
-Ilya
On Feb 28, 2006, at 2:45 PM, Thomas Kuo wrote:
> I am using the url of an image ".../cgi-bin/omeis?
> Method=ReadFile&FileID=622&fake=" to "download" the image for an
> ImageJ applet, so this is done through OMEIS's ReadFile.
>
> ImageJ's built-in URL reader reads the end of the URL to determine
> the file type, which is invalid with the above URL. So I am
> looking at ways to use Java and ImageJ to do this correctly. Among
> the ideas, I can read the filename from the header and determine
> the type, as you suggest, or use Java's included functions to
> extract the file type.
>
> However, I was wondering if it made sense for OMEIS or something
> else within OME to determine the file type beyond the generic octet-
> stream (such as image/tiff, etc.) and send that as the content-type
> header.
>
> ~Thomas
>
>
> Ilya Goldberg wrote:
>> When you say "download images", are you referring to OriginalFiles
>> (the OME object which corresponds to the File OMEIS object)?
>> I think raw pixel data (GetPixel*) and the ReadFile OMEIS methods
>> are the only ones that return application/octet-stream. If you
>> ask OMEIS for a rendered image, it returns the correct MIME type.
>> This is because application/octet-stream is the right thing for
>> pixel data, and OMEIS doesn't know anything about file types
>> (they're all application/octet-stream as far as OMEIS knows).
>>
>> It would be somewhat of a challenge to do this right. Possibly
>> with libmagic, possibly with the unix command "file". A very poor
>> way of doing this is how its done in Windows - by looking at the
>> file extension (the name of the file is stored by OMEIS).
>>
>> Can you give some details what you want to achieve by this?
>> Afterall, even though it downloads as an application/octet-stream,
>> the OS will surely know what kind of file it is once you try to do
>> something with it.
>> -Ilya
>>
>>
>> On Feb 28, 2006, at 12:51 PM, Thomas Kuo wrote:
>>
>>> Hello,
>>>
>>> I've been trying to download images from the OME database;
>>> however, the
>>> content-type or MIME type is currently set to application/octet-
>>> stream
>>> regardless of type. I think it should be set according to the
>>> data that
>>> is present, i.e. image/tiff for tiff images, etc. This may be
>>> fairly
>>> easily done using a program like libmagic, that extracts the type
>>> from
>>> the header information.
>>>
>>> ~Thomas
>>>
>>> --Thomas Kuo
>>> Graduate Student
>>> Electrical & Computer Engineering Department
>>> University of California Santa Barbara
>>> Email: thekuo at umail.ucsb.edu
>>>
>>> _______________________________________________
>>> ome-devel mailing list
>>> ome-devel at lists.openmicroscopy.org.uk
>>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
>>>
>
>
> --
> Thomas Kuo
> Graduate Student
> Electrical & Computer Engineering Department
> University of California Santa Barbara
> Email: thekuo at umail.ucsb.edu
>
More information about the ome-devel
mailing list