Overriding the NoDataPixel value

For discussion of LizardTech's free Decode SDK for MrSID and JPEG 2000.

Moderator: jskiffington

Overriding the NoDataPixel value

Postby Tubaman » Mon Feb 28, 2011 9:40 am

I'm attempting to mosaic a set of .sid images using an LTIMosaicFilter. One issue I have is that the image tiles overlap slightly, but our client who created the images using GeoExpress didn't set either the NoDataPixel or background colors, even though each image tile has some black border where there's no data available. The resulting problem is that when creating the mosaic, the filter doesn't recognise when dealing with overlapped regions that the black pixels means no data, and proceeds to use these in preference to the good data from the underneath tile.

From looking at the reference manual, I can see there's a LTIOverrideBackgroundPixelData class with a setNoDataPixel method, but I can't work out how to apply this to my MrSIDImageReader instances to set the NoData pixel color to black so that the mosaicFilter would then (hopefully!) use the good data in preference.

A code snippet showing how I could achieve this would be very much appreciated!
Tubaman
 
Posts: 3
Joined: Mon Feb 28, 2011 8:31 am

Postby ChrisH » Mon Feb 28, 2011 10:23 am

overrideNoDataPixel() will do what you want. Call it on each MrSIDImageReader instance prior to sending it to your MosaicFilter.

-chrisH
ChrisH
 
Posts: 14
Joined: Tue Feb 12, 2008 10:20 am

Postby Tubaman » Tue Mar 01, 2011 2:13 am

Thanks Chris, have got it working now. I think the problem was I was trying to set the no data pixel in the second parameter to the mosaicFilter->initialize(), rather than setting it for each reader before adding them to the stage manager.

I was initially not sure how to set the actual pixel color, but then realised for black it's easy as the pixel constructor sets the values to 0 as default, so by doing:

Code: Select all
LTIPixel ndPixel (reader->getColorSpace(),reader->getNumBands(),reader->getDataType());
reader->overrideNoDataPixel(&ndPixel);


for each reader, the no data pixel gets set correctly and the composite image from the mosaic filter now works great, correctly using the good data in preference to the black border pixels.

Thanks again for your help
Tubaman
 
Posts: 3
Joined: Mon Feb 28, 2011 8:31 am


Return to SDKs

Who is online

Users browsing this forum: No registered users and 2 guests

cron