Ejemplo n.º 1
0
void ProgCTFPhaseFlipping::run()
{
    show();

    // Read the micrograph in an array of doubles
    Image<double> M_in;
    M_in.read(fn_in);

    // Read CTF
    CTFDescription ctf;
    ctf.clear();
    ctf.read(fnt_ctf);
    ctf.changeSamplingRate(ctf.Tm*downsampling);
    ctf.produceSideInfo();

    actualPhaseFlip(M_in(),ctf);

    M_in.write(fn_out);
}
Ejemplo n.º 2
0
PyObject *
Image_applyCTF(PyObject *obj, PyObject *args, PyObject *kwargs)
{
    PyObject *input = NULL;
    double Ts=1.0;
    try
    {
        PyArg_ParseTuple(args, "Od", &input,&Ts);
        if (input != NULL)
        {
			PyObject *pyStr;
			if ((pyStr = PyObject_Str(input)) != NULL)
			{
				FileName fnCTF=PyString_AsString(pyStr);
			    ImageObject *self = (ImageObject*) obj;
	            ImageGeneric *image = self->image;
	            image->convert2Datatype(DT_Double);
	            MultidimArray<double> * pImage=NULL;
	            MULTIDIM_ARRAY_GENERIC(*image).getMultidimArrayPointer(pImage);

			    self->image->data->getMultidimArrayPointer(pImage);

		        CTFDescription ctf;
		        ctf.enable_CTF=true;
		        ctf.enable_CTFnoise=false;
		        ctf.read(fnCTF);
		        ctf.produceSideInfo();
		        ctf.applyCTF(*pImage,Ts);
		        Py_RETURN_NONE;
			}
        }
    }
    catch (XmippError &xe)
    {
        PyErr_SetString(PyXmippError, xe.msg.c_str());
    }
    return NULL;
}