[OpendTect_Developers] Data access & Seed point generation

Jaap Glas jaap.glas at dgbes.com
Thu Nov 22 14:31:01 CET 2012


Hi, David.

> I added a callback to OpendTect, which triggers when any PlaneDataDisplay is
> updating its data.
> mCBCapsuleUnpack(const visSurvey::PlaneDataDisplay&,pd,cb);

Where do you trigger it, in TextureChannels::update(.,.)? I think that is
not even good enough, because it would not catch a change of color map.
I cannot find one single location that is called by both changes of
(1) attributes, (2) color maps and (3) dimensions.

> I would prefer not to change OpendTect, but to implement everything into a
> plugin. Is there a way to get a notification when any SceneObject is changed?

At the moment, no. There is one for movements of scene objects, but not for
textural changes on scene objects. Apparently, no-one ever needed such a
callback up-to-now. However, if there is a need for it, we can include your
improvements, after reviewing them, in a future release of OpendTect.


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



On 11/21/2012 01:05 PM, David d'Angelo wrote:
> Hi Jaap,
>
> during debugging of my problem, I accidentally a wrong call of
> "tc2rgba_->createRGBA(image);" into the update function of the TextureChannels
> class.
>
> void TextureChannels::update( int channel, bool tc2rgba )
> {
> if ( !tc_ )
> return;
>
> SbImagei32 image;
> const int curversion = channelinfo_[channel]->getCurrentVersion();
> image.setValuePtr( SbVec3i32( channelinfo_[channel]->getSize(0),
> channelinfo_[channel]->getSize(1),
> channelinfo_[channel]->getSize(2) ), 1,
> channelinfo_[channel]->mappeddata_[curversion] );
>
> tc_->setChannelData( channel, image );
>
> if ( tc2rgba && tc2rgba_ )
> tc2rgba_->notifyChannelChange();
>
> //THIS CAUSED THE ERROR (added by myself)
> //calculate an rgba image of the data
> tc2rgba_->createRGBA(image);
>
> //some debugging code
> ...
> }
>
> I added a callback to OpendTect, which triggers when any PlaneDataDisplay is
> updating its data.
> mCBCapsuleUnpack(const visSurvey::PlaneDataDisplay&,pd,cb);
> I would prefer not to change OpendTect, but to implement everything into a
> plugin. Is there a way to get a notification when any SceneObject is changed?
>
> Cheers,
> David
>
>
> On 11/21/12 11:28 AM, Jaap Glas wrote:
>> 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
>>
>
>




More information about the Developers mailing list