当前位置: 首页>>代码示例>>C++>>正文


C++ Cube::Histogram方法代码示例

本文整理汇总了C++中Cube::Histogram方法的典型用法代码示例。如果您正苦于以下问题:C++ Cube::Histogram方法的具体用法?C++ Cube::Histogram怎么用?C++ Cube::Histogram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cube的用法示例。


在下文中一共展示了Cube::Histogram方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: IsisMain

void IsisMain() {

    // Setup the input and output cubes
    ProcessByLine p;  // used for getting histograms from input cubes
    Cube *icube = p.SetInputCube("FROM", Isis::OneBand);
    p.SetOutputCube ("TO");

    // Histogram parameters
    UserInterface &ui = Application::GetUserInterface(); 
    double minimum = ui.GetDouble("MINPER");
    double maximum = ui.GetDouble("MAXPER");
    int increment = ui.GetInteger("INCREMENT");

    // Histograms from input cubes
    Histogram *from = icube->Histogram();
    Histogram *match = icube->Histogram();

    double fromMin = from->Percent(minimum);
    double fromMax = from->Percent(maximum);
    int fromBins = from->Bins();
    double data[fromBins];
    double slope = (fromMax - fromMin) / (fromBins - 1);

    // Set "match" to have the same data range and number of bins as "to"
    match->SetBins(fromBins);
    match->SetValidRange(fromMin, fromMax);
    for (int i = 0; i < fromBins; i++) {
        data[i] = fromMin + (slope * i);
    }
    match->AddData(data, fromBins);

		stretch.ClearPairs();
		double lastPer = from->Percent(minimum);
    stretch.AddPair(lastPer, match->Percent(minimum));
    for (double i = increment+minimum; i < maximum; i += increment) {
				double curPer = from->Percent(i);
        if (lastPer < curPer) {
						if(abs(lastPer - curPer) > DBL_EPSILON) {
  	          stretch.AddPair(curPer, match->Percent(i));
							lastPer = curPer;
						}
				}
    }
		double curPer = from->Percent(maximum);
		if (lastPer < curPer && abs(lastPer - curPer) > DBL_EPSILON) {
			stretch.AddPair(curPer, match->Percent(maximum));
		}

    // Start the processing
    p.StartProcess(remap);
    p.EndProcess();
}
开发者ID:assutech,项目名称:isis3,代码行数:52,代码来源:histeq.cpp

示例2: IsisMain

void IsisMain() {
    // Setup the input and output cubes along with histograms
    ProcessByLine p; 
    Cube *mcube = p.SetInputCube("MATCH", Isis::OneBand);
    Histogram *match = mcube->Histogram();
    p.ClearInputCubes();
    Cube *icube = p.SetInputCube("FROM", Isis::OneBand);
    Histogram* from = icube->Histogram();
    p.SetOutputCube ("TO");

    // Histogram specifications
    UserInterface &ui = Application::GetUserInterface();
    double minimum = ui.GetDouble("MINPER");
    double maximum = ui.GetDouble("MAXPER");

    stretch.ClearPairs();

    // CDF mode selected
    if (ui.GetString("STRETCH") == "CDF") {
        int increment = ui.GetInteger("INCREMENT");
				double lastPer = from->Percent(minimum);
        stretch.AddPair(lastPer, match->Percent(minimum));
        for (double i = increment+minimum; i < maximum; i += increment) {
						double curPer = from->Percent(i);
            if (lastPer < curPer && abs(lastPer - curPer) > DBL_EPSILON) {
                stretch.AddPair(curPer, match->Percent(i));
								lastPer = curPer;
						}
				}
				double curPer = from->Percent(maximum);
				if (lastPer < curPer && abs(lastPer - curPer) > DBL_EPSILON) {
					stretch.AddPair(curPer, match->Percent(maximum));
				}
    }

    // Modal mode is selected
    else {
        stretch.AddPair(from->Percent(minimum), match->Percent(minimum));
        stretch.AddPair(from->Mode(), match->Mode());
        stretch.AddPair(from->Percent(maximum), match->Percent(maximum));
    }

    // Start the processing
    p.StartProcess(remap);
    p.EndProcess();
}
开发者ID:assutech,项目名称:isis3,代码行数:46,代码来源:histmatch.cpp


注:本文中的Cube::Histogram方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。