Ejemplo n.º 1
0
ossimMaskFilter::ossimMaskFilter(ossimImageSource* imageSource,
				 ossimImageSource* maskSource)
  :ossimImageCombiner(NULL,
                      2,
                      0,
                      true,
                      false),
   theMaskType(OSSIM_MASK_TYPE_SELECT),
   theTile(NULL)
{
  connectMyInputTo(0, imageSource);
  connectMyInputTo(1, maskSource);
} 
Ejemplo n.º 2
0
ossimImageFileWriter::ossimImageFileWriter(const ossimFilename& file,
                                           ossimImageSource* inputSource,
                                           ossimObject* owner)
   : ossimImageWriter(owner,
                      1,
                      0,
                      true,
                      false),
     ossimProcessInterface(),
     ossimConnectableObjectListener(),
     theViewController(NULL),
     theProgressListener(NULL),
     theFilename(file),
     theOutputImageType(ossimImageTypeLut().getEntryString(OSSIM_IMAGE_TYPE_UNKNOWN)),
     theWriteImageFlag(true),
     theWriteOverviewFlag(false),
     theWriteHistogramFlag(false),
     theScaleToEightBitFlag(false),
     theOverviewCompressType(COMPRESSION_NONE),
     theOverviewJpegCompressQuality(75),
     theWriteEnviHeaderFlag(false),
     theWriteErsHeaderFlag(false),     
     theWriteExternalGeometryFlag(false),
     theWriteFgdcFlag(false),
     theWriteJpegWorldFileFlag(false),
     theWriteReadmeFlag(false),
     theWriteTiffWorldFileFlag(false),
     theWriteWorldFileFlag(false),
     theAutoCreateDirectoryFlag(true),
     theLinearUnits(OSSIM_UNIT_UNKNOWN),
     thePixelType(OSSIM_PIXEL_IS_POINT)
{
   if (traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << "ossimImageFileWriter::ossimImageFileWriter entered..."
         << std::endl;
#ifdef OSSIM_ID_ENABLED
      ossimNotify(ossimNotifyLevel_DEBUG)
         << "OSSIM_ID:  " << OSSIM_ID << std::endl;
#endif
   }

   theInputConnection = new ossimImageSourceSequencer(inputSource);

   // now map the sequencer to the same input
   connectMyInputTo(0, inputSource);
   initialize();

   // make sure we listen to our input changes so we can change
   // it for the sequencer as well.
   ossimImageWriter::addListener((ossimConnectableObjectListener*)this);

   theInputConnection->connectMyInputTo(0, inputSource, false);
   theAreaOfInterest.makeNan();
}
void ossimQtSingleImageWindow::displayImage(const ossimFilename& file)
{
    ossimRefPtr<ossimImageHandler> ih = ossimImageHandlerRegistry::instance()->open(file);
    if (!ih)
    {
        QString caption = "Sorry:";
        QString text = "Could not find the image handler for file:\n";
        text += file.c_str();
        QMessageBox::information( this,
                                  caption,
                                  text,
                                  QMessageBox::Ok );
        return;
    }

    if (ih->getNumberOfDecimationLevels() == 1)
    {
        QString caption("Question:");
        QString text = "Would you like to build reduced resolution data sets?\n";
        text += "Note:\n";
        text += "This can take some time depending on the size of your image.";
        text += "\nAlternatively use the command line application:  \"img2rr\"";

        int answer = QMessageBox::question( this,
                                            caption,
                                            text,
                                            QMessageBox::Yes,
                                            QMessageBox::No);
        if (answer == QMessageBox::Yes)
        {
            //---
            // We need to listen for the open overview signal to rebuild the
            // theResolutionLevelMenu.
            //---
            ih->addListener(this);
            buildOverViews( ih.get() );
        }
    }

    createImageChain( ih.get() );

    // Build the resolution level menu.
    buildResolutionLevelMenu();

    // Give it to the widget.
    theImageWidget->connectMyInputTo(theImageChain.get());
    theImageWidget->refresh();

    connectMyInputTo(theImageChain.get());
    QString caption = "iview : ";
    caption += file.file().c_str();
    setCaption(caption);
}
Ejemplo n.º 4
0
rspfHistogramWriter::rspfHistogramWriter(rspfImageSource* inputSource,
                                           rspfObject* owner)
   : rspfOutputSource(owner,
                       1,
                       0,
                       true,
                       false),
     theAreaOfInterest(),
     theFilename(),
     theFileStream(0),
     theProcessListener(0),
     theHistogramSource(0)
{
   theProcessListener = new rspfHistogramWriterProcessListener(this);
   
   theAreaOfInterest.makeNan();
   connectMyInputTo(0, inputSource);
}
ossimImageSourceSequencer::ossimImageSourceSequencer(ossimImageSource* inputSource,
                                                     ossimObject* owner)
:ossimImageSource(owner,
                  1,
                  1,
                  true,
                  false),
    theBlankTile(NULL),
    theAreaOfInterest(0,0,0,0),
    theTileSize(OSSIM_DEFAULT_TILE_WIDTH, OSSIM_DEFAULT_TILE_HEIGHT),
    theNumberOfTilesHorizontal(0),
    theNumberOfTilesVertical(0),
    theCurrentTileNumber(0)
{
   ossim::defaultTileSize(theTileSize);
   theAreaOfInterest.makeNan();
   theInputConnection    = inputSource;
   if(inputSource)
   {
     connectMyInputTo(0, inputSource);
     initialize(); // Derived class depends on this initialization to happen now. DO NOT MOVE.
   }
   addListener( (ossimConnectableObjectListener*)this);
}
Ejemplo n.º 6
0
//*****************************************************************************
//  METHOD: ossimAtbController::initializeWithCombiner()
//  
//*****************************************************************************
void ossimAtbController::initializeWithCombiner(ossimImageCombiner* combiner,
						ossimGridRemapEngine* engine)
{
   static const char MODULE[] = "ossimAtbController::initializeWithCombiner()";
   if (traceExec())  CLOG << "entering..." << endl;
   
   //***
   // Assign default engine if non provided:
   //***
   if (engine)
      theGridRemapEngine = (ossimGridRemapEngine*)engine->dup();
   else
      theGridRemapEngine
         = ossimGridRemapEngineFactory::create(DEFAULT_ATB_REMAP_ENGINE);
   
   //***
   // This is the first combiner initializing the controller. The combiner
   // will have all of the input sources connected already. We attach to
   // these:
   //***
   theContainer = PTR_CAST(ossimConnectableContainer, combiner->getOwner());
   
   //***
   // Need to scan the input connections of the combiner and insert a 
   // remapper if there is not one already at the end of the input chain:
   //***
   vector<ossimConnectableObject*> del_list;
   vector<ossimConnectableObject*> add_list;
   int numInputs = combiner->getNumberOfInputs();
   for(int i=0; i<numInputs; i++)
   {
      ossimImageSource* input_image = PTR_CAST(ossimImageSource,
                                               combiner->getInput(i));
      
      if (input_image)
      {
         ossimGridRemapSource* remapper = PTR_CAST(ossimGridRemapSource,
                                                   input_image);
         if (remapper)
         {
            //***
            // Remapper already present, set its remap engine to this
            // controller's remap engine:
            //***
            remapper->setRemapEngine(theGridRemapEngine);
         }
         
         else
         {
            //***
            // Need to instantiate remapper:
            //***
            remapper = new ossimGridRemapSource(input_image,
                                                theGridRemapEngine);
            if (theContainer.valid())
               theContainer->addChild(remapper);
            
            add_list.push_back(remapper);
            del_list.push_back(input_image);
         }

         connectMyInputTo(remapper);
      }            
   }
   
   //***
   // Need to delete the old inputs and add the new remappers to the
   // combiner's input list:
   //***
   vector<ossimConnectableObject*>::iterator add_iter = add_list.begin();
   vector<ossimConnectableObject*>::iterator del_iter = del_list.begin();
   while (add_iter != add_list.end())
   {
      (*add_iter)->connectMyInputTo(*del_iter);
      combiner->disconnect(*del_iter);
      combiner->connectMyInputTo(*add_iter);
      add_iter++;
      del_iter++;
   }
   combiner->initialize();
      
   if (traceExec())  CLOG << "returning..." << endl;
}
ossimQtSingleImageWindow::ossimQtSingleImageWindow(QWidget* parent,
        const char* name,
        Qt::WFlags f)
    : QMainWindow(parent, name, f),
      ossimConnectableObject(),
      ossimConnectableDisplayListener(),
      theImageWidget(0),
      theLastOpenedDirectory(),
      theResolutionLevelMenu(0)
{
    ossimReferenced::ref();
    setCaption("iview");

    QSize size(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    setBaseSize(size);

    // This set the window's widget size.
    setGeometry(0,0,DEFAULT_WIDTH-1,DEFAULT_HEIGHT-1);

    // Create the image widget parenting it to this.
    theImageWidget = new ossimQtScrollingImageWidget(this, "image_widget");

    // This will clear out any initial garbage in the widget.
    theImageWidget->refresh();

    // Disable random caching scheme.
    theImageWidget->setRandomPriorityQueueEnabledFlag(false);

    // Set the the width and height of the window.
    theImageWidget->resize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // Make the image widget the centralized widget.
    setCentralWidget(theImageWidget);

    // Make the "File" pull down menu.
    QMenu* file = new QMenu( this );
    menuBar()->insertItem( "&File", file );
    file->insertItem( "&Open Image",  this, SLOT(openImage()), Qt::CTRL+Qt::Key_O );
    file->insertItem( "&Close Image",  this, SLOT(closeImage()), Qt::CTRL+Qt::Key_C );
    file->insertItem( "&Export",  this, SLOT(exportImage()), Qt::CTRL+Qt::Key_E );
    file->insertItem( "&Quit",  this, SLOT(closeWindow()), Qt::CTRL+Qt::Key_Q );

    // Make the "Edit" pull down menu.
    QMenu* edit = new QMenu( this );
    menuBar()->insertItem( "&Edit", edit );
    edit->insertItem( "Image Chain",  this, SLOT(editImageChain()));

    // Make the "Utilities" pull down menu.
    QMenu* utilities = new QMenu( this );
    menuBar()->insertItem( "&Utilities", utilities );
    utilities->insertItem( "Refresh",  this, SLOT(refreshDisplay()));

    // Make the "Resolution_Level" pull down menu.
    theResolutionLevelMenu = new QMenu( this );
    menuBar()->insertItem( "&Resolution_Level",  theResolutionLevelMenu);

    QAction* rsetAct = new QAction(QString("0"), this);
    rsetAct->setCheckable(true);
    rsetAct->setChecked(true);
    rsetAct->setData(0);
    rsetAct->setEnabled(false);

    theResolutionLevelMenu->addAction( rsetAct );

    // Connect the activated signal to the changeResolutionLevel slot.
    connect( theResolutionLevelMenu, SIGNAL( triggered( QAction * ) ),
             this, SLOT ( changeResolutionLevel( QAction * ) ) );

    // Make the "Help" pull down menu.
    QMenu* help = new QMenu( this );
    menuBar()->insertItem( "&Help", help );
    help->insertItem( "&About",  this, SLOT(about()), Qt::CTRL+Qt::Key_A );

    // Connect up the slot to capture mouse events.
    connect(theImageWidget,
            SIGNAL(scrollingImageWidgetMouseEvent(ossimQtMouseEvent*)),
            this,
            SLOT(trackImageWidget(ossimQtMouseEvent*)));

    // Add us in as a listener for display events like refresh.
    addListener((ossimConnectableDisplayListener*)this);

    //---
    // Connect this display up to "theImageWidget" so that event propagation
    // comes up the chain to us.
    //---
    connectMyInputTo(theImageWidget);

    // Send a dummy message to make the status bar show.
    statusBar()->message( QString(" ") );

    //---
    // Set the last open directory to the current working dir so the open image
    // dialog will come up where you started.
    //---
    theLastOpenedDirectory = getenv("PWD");
}