ossimDataObjectStatus ossimU11ImageData::validate() const
{
    if (m_dataBuffer.size() == 0)
    {
        setDataObjectStatus(OSSIM_NULL);
        return OSSIM_NULL;
    }

    ossim_uint32 count = 0;
    const ossim_uint32 SIZE = getSize();
    const ossim_uint32 BOUNDS = getSizePerBand();
    const ossim_uint32 NUMBER_OF_BANDS = getNumberOfBands();

    for(ossim_uint32 band = 0; band < NUMBER_OF_BANDS; ++band)
    {
        const ossim_uint16* p  = getUshortBuf(band);
        for (ossim_uint32 i=0; i<BOUNDS; ++i)
        {
            // check if the band is null
            if (p[i] != 0) ++count;
        }
    }

    if (!count)
        setDataObjectStatus(OSSIM_EMPTY);
    else if (count == SIZE)
        setDataObjectStatus(OSSIM_FULL);
    else
        setDataObjectStatus(OSSIM_PARTIAL);

    return getDataObjectStatus();
}
void ossimU11ImageData::convertToNormalizedDouble(ossimImageData* result)const
{
    if(!result)
    {
        return;
    }

    // make sure that the types and width and height are
    // good.
    if( (result->getScalarType() != OSSIM_NORMALIZED_FLOAT) ||
            (result->getNumberOfBands() != this->getNumberOfBands())||
            (result->getWidth() != this->getWidth()) ||
            (result->getHeight() != this->getHeight())||
            (result->getDataObjectStatus() == OSSIM_NULL) ||
            (getDataObjectStatus() == OSSIM_NULL))
    {
        return;
    }

    ossim_uint32 size = getSizePerBand();

    if(size > 0)
    {
        for(ossim_uint32 bandCount = 0; bandCount < m_numberOfDataComponents; ++bandCount)
        {
            const ossim_uint16* sourceBuf = getUshortBuf(bandCount);
            double* resultBuf = static_cast<double*>(result->getBuf(bandCount));
            for(ossim_uint32 counter = 0; counter <  size; ++counter)
            {
                resultBuf[counter] = m_remapTable.normFromPix(sourceBuf[counter]);
            }
        }
    }

}
ossimDataObjectStatus ossimS16ImageData::validate() const
{
   if (getBuf() == NULL)
   {
      setDataObjectStatus(OSSIM_NULL);
      return OSSIM_NULL;
   }
   
   ossim_uint32 count = 0;
   const ossim_uint32 SIZE = getSize();
   const ossim_uint32 BOUNDS = getSizePerBand();
   const ossim_uint32 NUMBER_OF_BANDS = getNumberOfBands();
   
   for(ossim_uint32 band = 0; band < NUMBER_OF_BANDS; ++band)
   {
      ossim_sint16 np = (ossim_sint16)m_nullPixelValue[band];
      const ossim_sint16* p  = getSshortBuf(band);
      for (ossim_uint32 i=0; i<BOUNDS; i++)
      {
         // check if the band is null
         if (p[i] != np) count++;         
      }
   }
   
   if (!count)
      setDataObjectStatus(OSSIM_EMPTY);
   else if (count == SIZE)
      setDataObjectStatus(OSSIM_FULL);
   else
      setDataObjectStatus(OSSIM_PARTIAL);

   return getDataObjectStatus();
}
void ossimU11ImageData::setNormalizedFloat(ossim_uint32 offset,
        ossim_uint32 bandNumber,
        float inputValue)
{
    if( (getDataObjectStatus() != OSSIM_NULL) &&  isValidBand(bandNumber) )
    {
        ossim_uint16* sourceBuf = getUshortBuf(bandNumber);
        sourceBuf[offset]
            = static_cast<ossim_uint16>(m_remapTable.pixFromNorm(inputValue));
    }
}
void ossimU11ImageData::getNormalizedFloat(ossim_uint32 offset,
        ossim_uint32 bandNumber,
        float& result)const
{
    if( (getDataObjectStatus() != OSSIM_NULL) && isValidBand(bandNumber) )
    {
        const ossim_uint16* sourceBuf = getUshortBuf(bandNumber);
        result =
            static_cast<float>(m_remapTable.normFromPix(sourceBuf[offset]));
    }
}
Beispiel #6
0
bool rspfDataObject::isInitialize()const
{
   return (getDataObjectStatus()!=RSPF_NULL);
}