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


C++ FileName::addExtension方法代码示例

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


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

示例1: main

int main(int argc, char *argv[]) 
{
	if(argc > 1)
	{
		if(!strcmp(argv[1], "-h"))
		{
			cout << "Paker - Compressão de ficheiros" << endl;
			cout << endl << "Para empacotar use:" << endl;
			cout << endl << argv[0] << " rle|lzss|mix repetition_bits|[position_bits coincidence_bits] <filename>" << endl;
			cout << endl << "ou para desempacotar:" << endl;
			cout << endl << argv[0] << " -u <filename>" << endl;
			cout << endl << "Para comprimir escolher um dos seguintes modos:" << endl;
			cout << endl << "\trle - Utilizar a te'cnica RLE sobre o ficheiro, ";
			cout << "e' necessa'rio fornecer o valore de repetition_bits (valores 4 por defeito)." << endl;
			cout << endl << "\tlzss - Utilizar a te'cnica LZSS sobre o ficheiro, ";
			cout << "e' necessa'rio fornecer os valores de position_bits e coincidence_bits (valores 10 e 4 por defeito)." << endl;
			cout << endl << "\tmix - Utilizar a te'cnica LZSS em conjunto com RLE sobre o ficheiro, ";
			cout << "e' necessa'rio fornecer os valores de repetition_bits, position_bits e coincidence_bits (valores 4, 10 e 4 por defeito)." << endl;
			cout << endl << endl << "ISEL 2008 - Fa'bio Oliveira [30979] e Renato Verissi'mo [30796]" << endl;

			return 0;
		}
		else if(!strcmp(argv[1], "-u"))
		{
			if (argc < 3) 
			{ 
				cout << "Use " << argv[0] << " -h para obter ajuda" << endl; 
				return 1; 
			}

			UnPk upk(argv[argc - 1]);
			int error = upk.init();
			
			if(error) 
				return error;
		    
			upk.go();
		}
		else 
		{
			if (argc < 4) 
			{ 
				cout << "Use " << argv[0] << " -h para obter ajuda" << endl; 
				return 1;
			}

			FileName iname = argv[argc - 1];
			FileName oname = iname.getBaseName();

			oname.addExtension(pk_ext);

			Pk pk(iname, oname);
			int error = pk.init();
			
			if(error) 
				return error;

			pk.go(argc - 2, argv + 1, iname.getExtension());
		}
	}
	else
	{
		cout << "Use " << argv[0] << " -h para obter ajuda" << endl; 	
		return 1;
	}
}
开发者ID:foliveira,项目名称:paker,代码行数:66,代码来源:paker.cpp

示例2: produce_all_images

/* Produce all images ------------------------------------------------------ */
void Micrograph::produce_all_images(int label, double minCost,
                                    const FileName &fn_rootIn, const FileName &fn_image, double ang,
                                    double tilt, double psi, bool rmStack)
{
    MetaData SF;
    Image<double> I;
    Micrograph *M;

    // Set Source image
    if (fn_image == "")
        M = this;
    else
    {
        M = new Micrograph;
        M->open_micrograph(fn_image/*, swapbyte*/);
        M->set_window_size(X_window_size, Y_window_size);
        M->set_transmitance_flag(compute_transmitance);
        M->set_inverse_flag(compute_inverse);
    }

    // Set scale for particles
    int MXdim, MYdim, thisXdim, thisYdim;
    M->size(MXdim, MYdim);
    this->size(thisXdim, thisYdim);
    double scaleX = (double) MXdim / thisXdim;
    double scaleY = (double) MYdim / thisYdim;

    // Compute max and minimum if compute_transmitance
    // or compute_inverse flags are ON
    double Dmax=0., Dmin=0.;
    if (compute_transmitance || compute_inverse)
    {
        (*this).computeDoubleMinMax(Dmin, Dmax);

        if (compute_transmitance)
        {
            if (Dmin > 1)
                Dmin = log10(Dmin);
            if (Dmax > 1)
                Dmax = log10(Dmax);
        }
    }
    // Scissor all particles
    if (ang != 0)
        std::cout << "Angle from Y axis to tilt axis " << ang << std::endl
        << "   applying appropriate rotation\n";
    int nmax = ParticleNo();
    FileName fn_aux;
    FileName _ext = fn_rootIn.getFileFormat();
    FileName fn_out;
    FileName fn_root = fn_rootIn.removeFileFormat().removeLastExtension();
    if (fn_rootIn.hasStackExtension())
        fn_out=fn_root.addExtension(_ext);
    else
    	fn_out=fn_rootIn.addExtension("stk");

    if (rmStack)
        fn_out.deleteFile();
    size_t ii = 0;
    size_t id;
    for (int n = 0; n < nmax; n++)
        if (coords[n].valid && coords[n].cost > minCost && coords[n].label == label)
        {
            fn_aux.compose(++ii, fn_out);
            id = SF.addObject();
            // If the ctfRow was set, copy the info to images metadata
            if (ctfRow.containsLabel(MDL_CTF_DEFOCUSU))
                SF.setRow(ctfRow, id);
            SF.setValue(MDL_IMAGE, fn_aux, id);
            SF.setValue(MDL_MICROGRAPH, M->fn_micrograph, id);
            SF.setValue(MDL_XCOOR, coords[n].X, id);
            SF.setValue(MDL_YCOOR, coords[n].Y, id);
            bool t = M->scissor(coords[n], I(), Dmin, Dmax, scaleX, scaleY);
            if (!t)
            {
                std::cout << "Particle " << fn_aux
                << " is very near the border, "
                << "corresponding image is set to blank\n";
                SF.setValue(MDL_ENABLED, -1, id);
            }
            else
                SF.setValue(MDL_ENABLED, 1, id);
            //  if (ang!=0) I().rotate(-ang);
            I.write(fn_out, ii, true, WRITE_APPEND);
        }
    SF.write(fn_out.withoutExtension() + ".xmd");


    // Free source image??
    if (fn_image != "")
    {
        M->close_micrograph();
        delete M;
    }
}
开发者ID:josegutab,项目名称:scipion,代码行数:96,代码来源:micrograph.cpp


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