Beispiel #1
0
void CalvinCELDataAdapter::GetParameters(FusionTagValuePairTypeList& values)
{
	ParameterNameValueTypeVector algParams;
	calvinCel.GetAlgorithmParameters(algParams);
	for (ParameterNameValueTypeIt ii = algParams.begin(); ii!= algParams.end(); ++ii)
	{
		FusionTagValuePairType ft;
		ft.Tag = ii->GetName();
		ft.Value = ii->ToString();
		ft.DetailedType() = *ii;
		values.push_back(ft);
	}
}
Beispiel #2
0
std::wstring CalvinCELDataAdapter::GetParams()
{
	std::wstring params;
	ParameterNameValueTypeVector algParams;
	calvinCel.GetAlgorithmParameters(algParams);
	for (ParameterNameValueTypeIt ii = algParams.begin(); ii!= algParams.end(); ++ii)
	{
		if (ii != algParams.begin())
			params += L";";
		params += ii->GetName();
		params += L":";
		params += ii->ToString();
	}
	return params;
}
Beispiel #3
0
std::wstring CalvinCELDataAdapter::GetAlgorithmParameterTag(int index)
{
	ParameterNameValueTypeVector algParams;
	calvinCel.GetAlgorithmParameters(algParams);

	std::wstring result;
	try
	{
		result = algParams.at(index).GetName();
	}
	catch(...)
	{
	}
	return result;
}
/*
 * Compare the chip summary parameters.
 */
void CHPCompareGCOStoCalvin::CompareChipSummary()
{
	TagValuePairTypeList &gparams = gcos.GetHeader().SummaryParameters();
	ParameterNameValueTypeVector cparams = calvin.GetChipSums();
	CHPCompareUtils::CompareInts((int)gparams.size(), (int)cparams.size(), differences, "chip summary size");
	if (gparams.size() != cparams.size())
	{
		return;
	}
	int index=0;
	for (TagValuePairTypeList::iterator it = gparams.begin(); it!=gparams.end(); ++it)
	{
		TagValuePairType &gparam = *it;
		ParameterNameValueType &cparam = cparams[index++];
		CHPCompareUtils::CompareStrings(gparam.Tag, cparam.GetName(), differences, "chip summary name");
		CHPCompareUtils::CompareStrings(gparam.Value, cparam.ToString(), differences, "chip summary value");
	}
}
Beispiel #5
0
ParameterNameValueTypeVector CHPData::GetChipSums()
{
	ParameterNameValueTypeVector nvt;
	ParameterNameValueTypeIt begin, end;
	ParameterNameValueType param;

	genericData.Header().GetGenericDataHdr()->GetNameValIterators(begin, end);
	while(begin != end)
	{
		std::wstring key = begin->GetName();
		if(key.compare(0, CHIP_SUMMARY_PARAMETER_NAME_PREFIX_S.size(),CHIP_SUMMARY_PARAMETER_NAME_PREFIX_S) == 0)
		{
			param = *begin;
			key.erase(0, CHIP_SUMMARY_PARAMETER_NAME_PREFIX_S.size());
			param.SetName(key);
			nvt.push_back(param);
		}
		begin++;
	}
	return nvt;
}
Beispiel #6
0
void DATFileUpdaterTest::CompareParameterNameValueTypeVectors(ParameterNameValueTypeVector& left, ParameterNameValueTypeVector& right)
{
	CPPUNIT_ASSERT(left.size() == right.size());

	for (ParameterNameValueTypeVector::size_type i = 0; i < left.size(); ++i)
	{
		CPPUNIT_ASSERT(left[i].GetName() == right[i].GetName());
		CPPUNIT_ASSERT(left[i].GetParameterType() == right[i].GetParameterType());

		switch(left[i].GetParameterType())
		{
		case ParameterNameValueType::FloatType:
			CPPUNIT_ASSERT(left[i].GetValueFloat() == right[i].GetValueFloat());
			break;
		case ParameterNameValueType::UInt8Type:
			CPPUNIT_ASSERT(left[i].GetValueUInt8() == right[i].GetValueUInt8());
			break;
    default:
			CPPUNIT_ASSERT(0);
      break;
		}
	}
}
Beispiel #7
0
int CalvinCELDataAdapter::GetNumberAlgorithmParameters()
{
	ParameterNameValueTypeVector algParams;
	calvinCel.GetAlgorithmParameters(algParams);
	return (int)algParams.size();
}
/*
 * Copy the file contents.
 */
bool CELConversionUtilities::Copy(CelFileData &inFile, CCELFileData &outFile, CELFileConversionOptions *options)
{
    // Set the dimensions
    outFile.SetDimensions(inFile.GetRows(), inFile.GetCols());

    // Set the intensities, stdv and pixels
    FloatVector values;
    int n = inFile.GetNumCells();
    inFile.GetIntensities(0, n, values);
    for (int i=0; i<n; i++)
    {
        outFile.SetIntensity(i, values[i]);
    }
    values.clear();
    inFile.GetStdev(0, n, values);
    for (int i=0; i<n; i++)
    {
        outFile.SetStdv(i, values[i]);
    }
    Int16Vector pixels;
    inFile.GetNumPixels(0, n, pixels);
    for (int i=0; i<n; i++)
    {
        outFile.SetPixels(i, pixels[i]);
    }

    // Set the outliers and masks.
    XYCoordVector xy;
    inFile.GetOutlierCoords(xy);
    n = (int) xy.size();
    for (int i=0; i<n; i++)
    {
        outFile.SetOutlier(xy[i].xCoord, xy[i].yCoord, true);
    }
    xy.clear();
    inFile.GetMaskedCoords(xy);
    n = (int) xy.size();
    for (int i=0; i<n; i++)
    {
        outFile.SetMask(xy[i].xCoord, xy[i].yCoord, true);
    }


    // Set the header.
    outFile.SetGridCorners(GetGrid(inFile));
    if((options != NULL)&&(options->m_ChipType != NULL))
    {
        outFile.SetChipType(options->m_ChipType);
    }
    else
    {
        outFile.SetChipType(StringUtils::ConvertWCSToMBS(inFile.GetArrayType()).c_str());
    }

    // Make sure the algorithm name is "Percentile" so it can import into GCOS.
    outFile.SetAlgorithmName("Percentile");
    //outFile.SetAlgorithmName(StringUtils::ConvertWCSToMBS(inFile.GetAlgorithmName()).c_str());

    // Add the first four algorithm parameters required by GCOS.
    FindAndAddAlgorithmParameter("Percentile", "75", inFile, outFile);
    FindAndAddAlgorithmParameter("CellMargin", "2", inFile, outFile);
    FindAndAddAlgorithmParameter("OutlierHigh", "1.500", inFile, outFile);
    FindAndAddAlgorithmParameter("OutlierLow", "1.004", inFile, outFile);

    // Set the CellMargin
    SetCellMargin(inFile, outFile, 2);

    ParameterNameValueTypeVector algParams;
    inFile.GetAlgorithmParameters(algParams);
    n = (int) algParams.size();
    string tag;
    string value;
    for (int i=0; i<n; i++)
    {
        tag = StringUtils::ConvertWCSToMBS(algParams[i].GetName());
        value = StringUtils::ConvertWCSToMBS(algParams[i].ToString());

        // Filter the first four required GCOS algorithm parameters.
        if (tag == "Percentile" || tag == "CellMargin" || tag == "OutlierHigh" || tag == "OutlierLow")
        {
            continue;
        }

        // Don't include the grid parameters added by the converter.
        if (tag.length() > strlen("Grid") && strncmp(tag.c_str(), "Grid", strlen("Grid")) == 0)
            continue;

        // Add the parameter;
        outFile.AddAlgorithmParameter(tag.c_str(), value.c_str());
    }
    if((options != NULL)&&(options->m_DATFileName != NULL))
    {
        std::string datHeader = CELFileConversionOptions::newDatName(GetDatHeader(inFile).c_str(), options->m_DATFileName);
        if(datHeader == "")
        {
            return false;
        }
        else
        {
            outFile.GetHeader().SetDatHeader(datHeader.c_str());
        }
    }
    else
    {
        outFile.GetHeader().SetDatHeader(GetDatHeader(inFile).c_str());
    }
    outFile.GetHeader().SetHeader(outFile.GetHeader().GetHeader().c_str());

    return true;
}