Exemple #1
0
bool ContextBase::handle_i()
{
	if (_argc <= _i+1) {
		_errorMsg = "\n***** ERROR: -i option given, but no input file specified. *****";
		return false;
	}
	addInputFile(_argv[_i+1]);
	markUsed(_i - _skipFirstArgs);
	_i++;
	markUsed(_i - _skipFirstArgs);
	return true;
}
bool ContextIntersect::handle_abam()
{
	if (_argc <= _i+1) {
		_errorMsg = "\n***** ERROR: -abam option given, but no query BAM file specified. *****";
		return false;
	}
	addInputFile(_argv[_i+1]);
	_queryFileIdx = getNumInputFiles() -1;
	markUsed(_i - _skipFirstArgs);
	_i++;
	markUsed(_i - _skipFirstArgs);
	return true;
}
bool ContextGroupBy::isValidState()
{
	// The user was required to have entered one or more columns
	if (_keyListOps->getColumns().empty()) {
		_errorMsg = "***** ERROR: -opCols parameter requires a value.";
		return false;
	}

	//default to stdin
	if (getNumInputFiles() == 0) {
		addInputFile("-");
	}
	//default grouping is cols 1,2,3
	if (_groupStr.empty()) _groupStr = "1,2,3";

	return ContextBase::isValidState();
}
bool ContextIntersect::handle_b()
{
	if (_argc <= _i+1) {
		_errorMsg = "\n***** ERROR: -b option given, but no database file specified. *****";
		return false;
	}

	do {
		addInputFile(_argv[_i+1]);
		int fileId = getNumInputFiles() -1;
		_dbFileIdxs.push_back(fileId);
		_fileIdsToDbIdxs[fileId] = _dbFileIdxs.size() -1;
		markUsed(_i - _skipFirstArgs);
		_i++;
		markUsed(_i - _skipFirstArgs);
	} while (_argc > _i+1 && _argv[_i+1][0] != '-');
	return true;
}
Exemple #5
0
bool ContextMerge::isValidState()
{
	// Special: The merge program does not have default
	//column operations, so if none were entered, disable column ops.
	if (_keyListOps->getColumns().empty() && _keyListOps->getOperations().empty()) {
		setColumnOpsMethods(false);
		delete _keyListOps;
		_keyListOps = NULL;
	}

	//default to stdin
	if (getNumInputFiles() == 0) {
		addInputFile("-");
	}
	if (!ContextBase::isValidState()) {
		return false;
	}

	//
	// Tests for stranded merge
	//
	if (_desiredStrand != FileRecordMergeMgr::ANY_STRAND) { // requested stranded merge
		// make sure file has strand.
		if (!getFile(0)->recordsHaveStrand()) {
			_errorMsg = "\n***** ERROR: stranded merge requested, but input file records do not have strand. *****";
			return false;
		}
		//make sure file is not VCF.
		if (getFile(0)->getFileType() == FileRecordTypeChecker::VCF_FILE_TYPE) {
			_errorMsg = "\n***** ERROR: stranded merge not supported for VCF files. *****";
			return false;
		}
	}

	return true;
}
Exemple #6
0
void oms::Mosaic::setupOrthoThumbnail(const std::string& filename,
                                      const std::string& entryId,
                                      const std::string& srsCode,
                                      ossim_uint32 resolution,
                                      const std::string& histogramAutoStretchModeType)
{
    thePrivateData->clear();
    std::string id = addInputFile(filename, entryId);
    if(id.empty())
    {
        return;
    }
    if(srsCode.empty())
    {
        ossimRefPtr<ossimImageGeometry> geom = thePrivateData->theImageChainList[0]->theHandler->getImageGeometry();
        if(geom.valid())
        {
            if(!dynamic_cast<ossimMapProjection*>(geom->getProjection()))
            {
                ossimIrect rect = thePrivateData->theImageChainList[0]->theHandler->getBoundingRect();
                if(!rect.hasNans())
                {
                    ossimGpt midPoint;
                    geom->localToWorld(rect.midPoint(), midPoint);
                    ossimMapProjection* mapProj = new ossimEquDistCylProjection();
                    mapProj->setMetersPerPixel(geom->getMetersPerPixel());
                    mapProj->setOrigin(midPoint);
                    thePrivateData->theViewGeometry = new ossimImageGeometry(0, mapProj);
                }
            }
            else
            {
                thePrivateData->theViewGeometry = (ossimImageGeometry*)geom->dup();
            }
        }
    }
    else
    {
        ossimRefPtr<ossimProjection> proj = ossimProjectionFactoryRegistry::instance()->createProjection(srsCode);
        thePrivateData->theViewGeometry = new ossimImageGeometry(0, proj.get());
    }
    if(!thePrivateData->theViewGeometry.valid())
    {
        return;
    }
    thePrivateData->theImageChainList[0]->theBandSelector = new ossimBandSelector;
    thePrivateData->theImageChainList[0]->theBandSelector->connectMyInputTo(0, thePrivateData->theImageChainList[0]->theHandler.get());

    thePrivateData->theImageChainList[0]->theHistogramRemapper = new ossimHistogramRemapper;
    thePrivateData->theImageChainList[0]->theHistogramRemapper->connectMyInputTo(0, thePrivateData->theImageChainList[0]->theBandSelector.get());

    if(!histogramAutoStretchModeType.empty())
    {
        if(thePrivateData->theImageChainList[0]->theHistogramRemapper->openHistogram(thePrivateData->theImageChainList[0]->theHandler->createDefaultHistogramFilename()))
        {
            thePrivateData->theImageChainList[0]->theHistogramRemapper->setStretchModeAsString(histogramAutoStretchModeType);
        }
    }
    thePrivateData->theImageChainList[0]->theReprojection = new ossimImageRenderer;
    thePrivateData->theImageChainList[0]->theReprojection->setView(thePrivateData->theViewGeometry.get());
    thePrivateData->theImageChainList[0]->theReprojection->connectMyInputTo(0, thePrivateData->theImageChainList[0]->theHistogramRemapper.get());

    ossimIrect bounds = thePrivateData->theImageChainList[0]->theReprojection->getBoundingRect();

    ossim_uint32 maxRes = ossim::max(bounds.width(), bounds.height());
    if(maxRes > resolution)
    {
        double scale = 0.0;

        if(resolution > 1)
        {
            scale = (double)maxRes/(double)(resolution-1);
        }
        else
        {
            scale = (double)maxRes/(double)(resolution);
        }
        ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(thePrivateData->theViewGeometry->getProjection());
        if(mapProj)
        {
            mapProj->applyScale(ossimDpt(scale,scale), true);
            thePrivateData->theImageChainList[0]->theReprojection->setView(thePrivateData->theViewGeometry.get());
        }
        else
        {
            return;
        }
    }
    thePrivateData->theMosaic->connectMyInputTo(thePrivateData->theImageChainList[0]->theReprojection.get());
    bounds = thePrivateData->theMosaic->getBoundingRect();
}
void NTupleEventReader::addInputFileWithoutCheck(const char * fileName) {
    // numberOfFiles += input->Add(fileName);
    addInputFile(fileName);
}