コード例 #1
0
void PlotDataFitFunction::interpolRegression(int column) {
    std::vector<std::pair<plot_t,plot_t> > points;
    if (pData_->getColumnCount() > column && pData_->getColumnType(column) == PlotBase::NUMBER&& pData_->getColumnType(0) == PlotBase::NUMBER) {
        PlotFunction* oldfunction = pDataOut_;
        bool ignoreFalseValues = ignoreFalseValues_.get();
        plot_t x;
        plot_t y;
        for (int i = 0; i < pData_->getRowsCount(); ++i) {
            PlotRowValue row = pData_->getRow(i);
            x = row.getCellAt(0).getValue();
            y = row.getCellAt(column).getValue();
            if (!ignoreFalseValues || (x == x && y == y))
                points.push_back(std::pair<plot_t,plot_t>(x,y));
        }
        std::pair<PlotExpression,plot_t> result = FunctionLibrary::fittingInterpol(points);
        pDataOut_ = new PlotFunction(result.first);
        pDataOut_->getPlotExpression().setExpressionName(expressionNameInput_.get());
        pDataOut_->setExpressionLength(static_cast<PlotFunction::ExpressionDescriptionLengthType>(expressionText_.getValue()),
            maxLength_.get(),selfDescription_.get());
        fittingValues_.mse = result.second;
        fittingValues_.column = column;
        fittingValues_.regressionType = FunctionLibrary::INTERPOLATION;
        setOutPortData();
        oldfunction->getPlotExpression().deletePlotExpressionNodes();
        delete oldfunction;
    }
    if (getProcessorWidget())
        getProcessorWidget()->updateFromProcessor();
}
コード例 #2
0
void PlotDataFitFunction::process() {
    tgtAssert(isInitialized(), "not initialized");
    if (inPort_.hasData() && inPort_.hasChanged()) {
        readData();
        calculate();
    }
    else if (!inPort_.hasData()){
        pData_ = 0;
        PlotFunction* oldPlotData;
        oldPlotData = pDataOut_;
        pDataOut_ = new PlotFunction();
        pDataOut_->getPlotExpression().setExpressionName(expressionNameInput_.get());
        pDataOut_->setExpressionLength(static_cast<PlotFunction::ExpressionDescriptionLengthType>(expressionText_.getValue()),
            maxLength_.get(),selfDescription_.get());
        setOutPortData();
        if (getProcessorWidget()){
            getProcessorWidget()->updateFromProcessor();
        }
        oldPlotData->getPlotExpression().deletePlotExpressionNodes();
        delete oldPlotData;
    }
    else if (inPort_.hasData() && !inPort_.hasChanged()) {
        calculate();
    }
    else {
        if (getProcessorWidget()){
            getProcessorWidget()->updateFromProcessor();
        }
    }
}
コード例 #3
0
void OTBVectorImageReaderProcessor::loadImage() {

    // necessary since the passed string reference might be changed during clearImage/invalidate,
    std::string filename = imageFile_.get();

    outPort_.setImagePath(filename);

    // check for empty filename
    
    if (filename.empty())
        return;

    // load image as texture
    hasImage = true;
    /*texture_ = TexMgr.load(filename, tgt::Texture::LINEAR,
        false, false, true, false);*/
    reader->SetFileName(filename.c_str());
    reader->GenerateOutputInformation();
    
    if (!hasImage) {
        LWARNING("Failed to load image: " << filename);
        imageFile_.set("");
    }

    setOutPortData();
    //invalidate();
}
コード例 #4
0
ファイル: plotdatamerge.cpp プロジェクト: alvatar/smartmatter
void PlotDataMerge::initialize() throw (VoreenException) {
    Processor::initialize();

    if (inPortFirst_.hasData()) {
        readData();
        calculate();
    }
    setOutPortData();
}
コード例 #5
0
void PlotFunctionDiscret::initialize() throw (tgt::Exception) {
    Processor::initialize();

    pDataOut_ = new PlotData(0,0);

    if (inPort_.hasData()) {
        readData();
        calculate();
    }
    setOutPortData();
}
コード例 #6
0
void PlotDataFitFunction::initialize() throw (tgt::Exception) {
    Processor::initialize();

    pDataOut_ = new PlotFunction(PlotExpression(""));

    if (inPort_.hasData()) {
        readData();
        calculate();
    }
    setOutPortData();
}
コード例 #7
0
void PlotFunctionDiscret::calculate() {
    if (!pData_)
        return;

    PlotData* newPlotData = new PlotData(0,0);

    if (!pData_->select(resetList_.interval,resetList_.stepwidth,*newPlotData)) {
        newPlotData->reset(0,0);
    }
    PlotData* oldData;
    oldData = pDataOut_;
    pDataOut_ = newPlotData;
    setOutPortData();
    if (getProcessorWidget()){
        getProcessorWidget()->updateFromProcessor();
    }
    delete oldData;
}
コード例 #8
0
void PlotDataFitFunction::recalculate() {
    tgtAssert(isInitialized(), "not initialized");
    if (!pData_)
        return;
    if (fittingValues_.column >= 0) {
        PlotFunction* newPlotData;
        newPlotData = new PlotFunction(*pDataOut_);
        newPlotData->getPlotExpression().setExpressionName(expressionNameInput_.get());
        newPlotData->setExpressionLength(static_cast<PlotFunction::ExpressionDescriptionLengthType>(expressionText_.getValue()),
            maxLength_.get(),selfDescription_.get());
        PlotFunction* oldData;
        oldData = pDataOut_;
        pDataOut_ = newPlotData;
        setOutPortData();
        if (getProcessorWidget()){
            getProcessorWidget()->updateFromProcessor();
        }
        oldData->getPlotExpression().deletePlotExpressionNodes();
        delete oldData;
    }
}
コード例 #9
0
void PlotFunctionDiscret::process() {
    tgtAssert(isInitialized(), "not initialized");
    if (inPort_.hasData() && inPort_.hasChanged()) {
        readData();
        calculate();
    }
    else if (!inPort_.hasData()){
        pData_ = 0;
        PlotData* oldPlotData;
        oldPlotData = pDataOut_;
        pDataOut_ = new PlotData(0,0);
        setOutPortData();
        if (getProcessorWidget()){
            getProcessorWidget()->updateFromProcessor();
        }
        delete oldPlotData;
    }
    else if (inPort_.hasData() && !inPort_.hasChanged()) {
        calculate();
    }
    else if (getProcessorWidget()){
        getProcessorWidget()->updateFromProcessor();
    }
}
コード例 #10
0
ファイル: plotdatamerge.cpp プロジェクト: alvatar/smartmatter
void PlotDataMerge::calculate() {
    tgtAssert(isInitialized(), "not initialized");

    PlotData* oldData;
    oldData = pDataOut_;
    if (pFirstData_ && !pSecondData_)
        pDataOut_ = new PlotData(*pFirstData_);
    else if (!pFirstData_ && pSecondData_)
        pDataOut_ = new PlotData(*pSecondData_);
    else if (!pFirstData_ && !pSecondData_)
        pDataOut_ = 0;
    else {
        pDataOut_ = new PlotData(1,5);
        if (ignoreColumnLabel_.get())
            pFirstData_->mergeWith(*pSecondData_,*pDataOut_,PlotData::IGNORECOLUMNLABELS);
        else
            pFirstData_->mergeWith(*pSecondData_,*pDataOut_);
    }
    setOutPortData();
    if (getProcessorWidget()){
        getProcessorWidget()->updateFromProcessor();
    }
    delete oldData;
}
コード例 #11
0
void OTBVectorImageReaderProcessor::initialize() throw (tgt::Exception) {
    Processor::initialize();
    setOutPortData();
    hasImage = false;
}