[osg-users] [forum] TIFF loader: Error reding/decoding file . Does OSG support TIFF ( single strip 32 float ) ?

101 views
Skip to first unread message

Alexander Golyakov

unread,
Feb 25, 2015, 2:34:41 PM2/25/15
to osg-...@lists.openscenegraph.org
Hi,
I have TIFF raster data written as in single strip 32 float. In attempt to visualize
osgviewer.exe –image f32_single_strip.tif
I get an error
TIFF loader: Error reading/decoding file
osgviewer.exe: No data loaded

I tried this in a different version of OSG (3.0.1, 3.2.1 and so on). I suppose it happens in all versions.
Here are the properties of f32_single_strip.tif file:
gdalinfo f32_single_strip.tif
Driver: GTiff/GeoTIFF
Files: f32_single_strip.tif
Size is 256, 256
Coordinate System is `'
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 256.0)
Upper Right ( 256.0, 0.0)
Lower Right ( 256.0, 256.0)
Center ( 128.0, 128.0)
Band 1 Block=256x8 Type=Float32, ColorInterp=Gray

If I execute the next command using GDAL:
gdal_translate -ot Float32 f32_single_strip.tif f32_multi_strip.tif
then there is no reading error in f32_multi_strip.tif file. GDAL writes TIFF as multistrip.
Here are the properties of f32_multi_strip.tif file:
gdalinfo f32_multi_strip.tif
Driver: GTiff/GeoTIFF
Files: f32_multi_strip.tif
Size is 256, 256
Coordinate System is `'
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 256.0)
Upper Right ( 256.0, 0.0)
Lower Right ( 256.0, 256.0)
Center ( 128.0, 128.0)
Band 1 Block=256x8 Type=Float32, ColorInterp=Gray

How can I visualize TIFF data using OSG ( single strip 32 float )?

Thank you!

Cheers,
Alexander

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=62809#62809

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Robert Osfield

unread,
Feb 25, 2015, 2:50:03 PM2/25/15
to OpenSceneGraph Users
Hi Alexander,

I don't recall others users coming across this specific issue, so it may simply be that the format it not widely used enough for other users to try it with the OSG.  The OSG use libtiff to do the actual loading of the .tif file and the error "TIFF loader: Error reading/decoding file" you mention looks like one stemming from libtiff, if this is the case then perhaps changing libtiff version will help.

Could you provide the problem image file so that others can try it?

Another route you could try is to compile the OSG's GDAL plugin and have it handle the image loading.  Try appending .gdal to the filename and this will ensure that the file gets passed on to the GDAL plugin that will then attempt to load.  At least that I vaguely recall be possible... it might be a decade since I tried that though :)

Robert.

Alexander Golyakov

unread,
Feb 26, 2015, 8:14:40 AM2/26/15
to osg-...@lists.openscenegraph.org
Hi,

this is file data


Thank you!

Cheers,
Alexander

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=62830#62830




Attachments:
http://forum.openscenegraph.org//files/f32_single_strip_120.tif

Robert Osfield

unread,
Feb 26, 2015, 9:26:50 AM2/26/15
to OpenSceneGraph Users
Hi Alexander,


On 26 February 2015 at 03:58, Alexander Golyakov <golya...@yandex.ru> wrote:
this is file data

Thanks for the file.  I can reproduce the issue when I run:

  osgviewer --image f32_single_strip_120.tif

But if I use the .gdal plugin to load the image it loads:

  osgviewer --image f32_single_strip_120.tif.gdal

So there is a workaround you could employ.

I have put some debugging code into TIFF plugin and the point of failure comes when the plugin checks the TIFFTAG_SAMPLESPERPIXEL in the line:

    if (TIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel) == 1)

But this fails and the plugin fallbacks to generating the read error.

I'm not the author of the tiff plugin so haven't ever learnt about libtiff so don't know if this issue is a possible problem in libtiff or that their might be a suitable fallback that we could use.  The SAMPLESPERPIXEL value is used by the OSG to set the image format so not something that can be ignored.

I'm afraid I don't have any other insights to provide, perhaps others who are familiar with libtiff can chip in.  Right now I'd recommend using the .gdal plugin as a fallback.

Robert.

 
Reply all
Reply to author
Forward
0 new messages