thatcher / openseadragon

This project has moved to its new github organization at github.com/openseadragon, please join us!
http://openseadragon,github.com/
37 stars 14 forks source link

Viewer.OpenDZI implemented? #12

Closed dgutman closed 11 years ago

dgutman commented 12 years ago

I was trying to port some of my initial applet's from the initial Seadragon project to OpenSeadragon...

So I called:

myviewer = new OpenSeadragon.Viewer("container")

I then tried to use the openDzi method (command below)... and it didn't seem to work. I am not sure if this function simply hasn't been ported over yet.... in my case I am actually using the IIP Image Server to serve up DZI formatted images (so instead of having thousands of small JPEG's, IIPImage allows me to save the file as a single pyramidal tiff and generates the appropriate JPEG's on the fly).....
There's one little hack within the IIP framework to get this type of image served... basically I must prepend a '.dzi' extension to the "real" filename.. so it wasn't clear if the OpenSeaDragon is subsequently stripping out the dzi extension on the URL I am passing the function and so the call subsequently is not working...

myviewer.openDzi('http://localhost/cgi-bin/iipsrv.fcgi?DeepZoom=/my/file/Examplefile.tif.dzi')

So the "real" filename on my system is Examplefile.tif, but by adding the DZI extension the IIP image server knows I want to serve the image as a DZI file (it also supports a couple of other formats)..

When I actually hit the URL though, it does serve up a VALID XML file....

However when I call Viewer.opendzi('http://localhost/cgi-bin/iipsrv.fcgi?DeepZoom=/my/file/Examplefile.tif.dzi')

I get: Uncaught TypeError: Cannot read property 'dimensions' of null

I realize a lot of the new changes are related to using the TileSource as the way to open it, but I was first trying to simply get my old code working before I try and migrate anything to the new way of doing things...

jakecobb commented 12 years ago

This functionality is broken because processDZI tries to call imageFormatSupported without qualifying it:

https://github.com/thatcher/openseadragon/blob/42c5c6b7610bb7aa2414ecaac72840e9a88e2493/openseadragon.js#L1767

That should be changed from:

        if ( !imageFormatSupported( fileFormat ) ) {
            throw new Error(
                $.getString( "Errors.ImageFormat", fileFormat.toUpperCase() )
            );
        }

to:

        if ( !$.imageFormatSupported( fileFormat ) ) {
            throw new Error(
                $.getString( "Errors.ImageFormat", fileFormat.toUpperCase() )
            );
        }

Otherwise imageFormatSupported is undefined and this propagates to cause the TypeError described above.

thatcher commented 11 years ago

this should be patched already, sorry for the delay