[OpendTect_Developers] Data access & Seed point generation

Jaap Glas jaap.glas at dgbes.com
Wed Nov 21 11:28:58 CET 2012


Dear David,


In my previous reply I accidently wrote one erroneous line of code:

 >> pd->getChannels()->getChannels()->createRGBA( img );

which, as you already discovered yourself, should have been:

pd.getChannels()->getChannels2RGBA()->createRGBA( img );


================================================================


But let's now look at your current problem:

 > mCBCapsuleUnpack(const visSurvey::PlaneDataDisplay&,pd,cb);
 > SbImagei32 img;
 > SbVec3i32 size;
 > int bytesPerPixel;
 > pd.getChannels()->getChannels2RGBA()->createRGBA( img );
 > unsigned char* data = img.getValue(size,bytesPerPixel);
 > int width = size[0];
 > int height = size[1];
 > int depth = size[2];
 >
 > std::cout << "image size: " << size[0] << " "<< size[1] << size[2] << std::endl;
 > std::cout << "bytes per pixel: " << bytesPerPixel << std::endl;
 >
 > Output:
 > PIX Image size: 360 1167
 > PIX bytesPerPixel: 1
 >
 > The strange thing is that bytesPerPixel is always 1. I assumed I would get 4 for
 > the RGBA image. It is also strange that I always get the same pixel size
 > regardless of the displayed size of the line (in my case I tried it with a
 > crossline). See the two attached screenshots.

 > Could you think of a reason for this?

So far, unfortunately not. I did a test by adding your piece of code (below)
to OpendTect and call it every time a visSurvey::PlaneDataDisplay is updated:

 > SbImagei32 img;
 > SbVec3i32 size;
 > int bytesPerPixel;
 > pd.getChannels()->getChannels2RGBA()->createRGBA( img );
 > unsigned char* data = img.getValue(size,bytesPerPixel);
 > int width = size[0];
 > int height = size[1];
 > int depth = size[2];
 >
 > std::cout << "image size: " << size[0] << " "<< size[1] << size[2] << std::endl;
 > std::cout << "bytes per pixel: " << bytesPerPixel << std::endl;

If I add an inline or crossline to the scene, or use their tabs to resize,
I always get returned 4 bytes per pixel and what look like to be the
correct dimensions. So it does not seem to be a bug in OpendTect.

The only line I did not use is:

 > mCBCapsuleUnpack(const visSurvey::PlaneDataDisplay&,pd,cb);

Are you sure you receive the correct plane over there?

Otherwise we may start thinking about differences in the
OpendTect versions we use. Which version are you using?


Best regards,

Jaap Glas

-- 
-- dr. Jaap C. Glas
-- Software Engineer
-- dGB Earth Sciences
-- Nijverheidstraat 11-2
-- 7511 JM Enschede, The Netherlands
-- jaap.glas at dgbes.com
-- http://www.dgbes.com
-- Tel: +31 534315155, Fax: +31 534315104







More information about the Developers mailing list