Axisymetry_t Base_t::writeAxisymmetry( const vector<float>& refpt, const vector<float>& axis )
{
	Array<float> apt(refpt), ax(axis);
	int ier = cg_axisym_write( getFileID(), getID(), apt, ax );
	check_error( "Base_t::writeAxiSymmetry", "cg_axisym_write", ier );
	return Axisymetry_t(push( "Axisymmetry_t", 1 ));
}
Axisymetry_t Base_t::readAxisymmetry( vector<float>& refpt, vector<float>& axis ) const
{
	Array<float> apt(3), ax(3);	
	int ier = cg_axisym_read( getFileID(), getID(), apt, ax );
	check_error( "Base_t::readAxiSymmetry", "cg_axisym_read", ier );
	refpt = apt;
	axis  = ax;
	return Axisymetry_t(push( "Axisymmetry_t", 1 ));
}
Example #3
0
void main()
{
	std::string strInputFile;
	std::cout << "Input image file: ";	//запрос открываемого файла
	std::getline(std::cin, strInputFile);

	size_t nReqSize = NPngProc::readPngFile(strInputFile.c_str(), 0, 0, 0, 0);
	if (nReqSize == NPngProc::PNG_ERROR)
	{
		std::cout << std::endl << "Error ocured while png file was read." << std::endl;
		std::getchar();
		return;
	}

	unsigned char* pInputBits = new unsigned char[nReqSize];
	if (!pInputBits)
	{
		std::cout << "Can't allocate memory for image, required size is " << nReqSize << std::endl;
		std::getchar();
		return;
	}

	unsigned char* pOutputBits = new unsigned char[nReqSize];
	if (!pInputBits)
	{
		std::cout << "Can't allocate memory for image, required size is " << nReqSize << std::endl;
		std::getchar();
		return;
	}

	size_t nWidth, nHeight;
	unsigned int nBPP;

	size_t nRetSize = NPngProc::readPngFileGray(strInputFile.c_str(),
		pInputBits, &nWidth, &nHeight/*, &nBPP*/);
	nBPP = 8;


	NPngProc::SImage in(pInputBits, nWidth, nHeight, 8);
	NPngProc::SImage out(pOutputBits, nWidth, nHeight, 8);

	NPngProc::SImage apt(0, 0, 0, 8);

	MakeApt(apt);

	Median(in, out, apt);

	//получение имени нового файла

	std::string strOutputFile(strInputFile);
	int dotPos = strOutputFile.find_last_of('.');
	strOutputFile.insert(dotPos, "_proc");
	std::cout << "Name of output file is " << strOutputFile << std::endl;

	if (NPngProc::writePngFile(strOutputFile.c_str(),
		out.pBits, out.nWidth, out.nHeight, nBPP) == NPngProc::PNG_ERROR)
	{
		std::cout << "Error occured during png file was written." << std::endl;
		std::getchar();
		return;
	}

	std::getchar();
	return;
}