Example #1
0
ossimRefPtr<ossimNBandLutDataObject> ossimNitfImageHeader::createLut(
   ossim_uint32 bandIdx)const
{
   ossimRefPtr<ossimNBandLutDataObject> result;
   
   if(bandIdx < (ossim_uint32)getNumberOfBands())
   {
      const ossimRefPtr<ossimNitfImageBand> band = getBandInformation(bandIdx);
      if(band.valid())
      {
         ossim_uint32 bands = band->getNumberOfLuts();
         if(bands > 0)
         {
            if(band->getLut(0).valid())
            {
               ossim_uint32 entries = band->getLut(0)->getNumberOfEntries();
               
               result = new ossimNBandLutDataObject();
               result->create(entries, band->getNumberOfLuts());
               ossim_uint32 bIdx;
               ossim_uint32 entryIdx;

               for(bIdx = 0; bIdx < bands; ++bIdx)
               {
                  const ossimRefPtr<ossimNitfImageLut> lut = band->getLut(bIdx);
                  if(lut.valid())
                  {
                     for(entryIdx = 0; entryIdx < entries; ++entryIdx)
                     {
                        (*result)[entryIdx][bIdx] = (ossimNBandLutDataObject::LUT_ENTRY_TYPE)(lut->getValue(entryIdx));
                     }
                  }
               }
            }
         }
      }
   }

   return result;
}
Example #2
0
bool ossimNitfImageHeader::hasLut() const
{
   bool result = false;

   const ossim_uint32 BANDS = static_cast<ossim_uint32>(getNumberOfBands());
   for (ossim_uint32 band = 0; band < BANDS; ++band)
   {
      const ossimRefPtr<ossimNitfImageBand> imgBand = getBandInformation(band);
      if(imgBand.valid())
      {
         ossim_uint32 luts = imgBand->getNumberOfLuts();
         if(luts > 0)
         {
            if(imgBand->getLut(0).valid())
            {
               result = true;
               break;
            }
         }
      }
   }
   
   return result;
}