void ossimBandSelector::setOutputBandList( const vector<ossim_uint32>& outputBandList )
{
   if (outputBandList.size())
   {
      theOutputBandList = outputBandList;  // Assign the new list.

      bool setBands = false;
      ossimRefPtr<ossimImageHandler> ih = getBandSelectableImageHandler();
      if ( ih.valid() )
      {
         // Our input is a single image chain that can do band selection.
         if ( ih->setOutputBandList( outputBandList ) )
         {
            thePassThroughFlag = true;
            setBands = true;
            theTile = 0; // Don't need.
         }
      }

      if ( setBands == false )
      {
         if ( theTile.valid() && ( theTile->getNumberOfBands() != outputBandList.size() ) )
         {
            theTile = 0;       // Force an allocate call next getTile.
         }
         theWithinRangeFlag = ossimBandSelectorWithinRangeFlagState_NOT_SET;
         checkPassThrough();
         //theOrderedCorrectlyFlag = isOrderedCorrectly();
      }
   }
}
void ossimBandSelector::initialize()
{
   // Base class will recapture "theInputConnection".
   ossimImageSourceFilter::initialize();
   
   theWithinRangeFlag =  ossimBandSelectorWithinRangeFlagState_NOT_SET;

   if(theInputConnection)
   {
      if ( !theOutputBandList.size() ) 
      {
         // First time through set the output band list to input.
         theInputConnection->getOutputBandList(theOutputBandList);
      }

      // See if we have a single image chain with band selectable image handler.
      ossimRefPtr<ossimImageHandler> ih = getBandSelectableImageHandler();
      if ( ih.valid() )
      {
         if ( theOutputBandList.size() )
         {
            ih->setOutputBandList( theOutputBandList );
         }
         thePassThroughFlag = true;
      }
      else
      {
         checkPassThrough();
      }
      
      if ( isSourceEnabled() )
      {
         // theOrderedCorrectlyFlag = isOrderedCorrectly();
         
         if ( theTile.valid() )
         {
            //---
            // Check for:
            // - ordered correctly
            // - band change
            // - scalar change
            //---
            if( ( theTile->getNumberOfBands() != theOutputBandList.size() ) ||
                ( theTile->getScalarType() !=
                  theInputConnection->getOutputScalarType() ) )
            {
               theTile = 0; // Don't need it.
            }
         }
      }
   }
   else // No input connection.
   {
      thePassThroughFlag = true;
   }

   if ( !isSourceEnabled() )
   {
      theTile = 0;
   }
}
 bool checkThisPassThrough() {
     return checkPassThrough(node);
 }
 bool checkParentPassThrough() {
     return node->parent() && checkPassThrough(node->parent());
 }