Xmipp  v3.23.11-Nereus
Classes | Enumerations | Functions
project (Generate projections from a volume)
Collaboration diagram for project (Generate projections from a volume):

Classes

class  ProgProject
 
struct  Angle_range
 
class  ParametersProjection
 
class  PROJECT_Side_Info
 

Enumerations

enum  projectionType { REALSPACE, SHEARS, FOURIER }
 Type of projection. More...
 

Functions

int PROJECT_Assign_angles (MetaData &DF, const ParametersProjection &prm)
 
int PROJECT_Effectively_project (const FileName &fnOut, bool singleProjection, int projType, const ParametersProjection &prm, PROJECT_Side_Info &side, const Crystal_Projection_Parameters &prm_crystal, Projection &proj, MetaData &SF)
 
int ROUT_project (ProgProject &prm, Projection &proj, MetaData &SF)
 

Detailed Description

Enumeration Type Documentation

◆ projectionType

Type of projection.

Enumerator
REALSPACE 
SHEARS 
FOURIER 

Definition at line 42 of file project.h.

Function Documentation

◆ PROJECT_Assign_angles()

int PROJECT_Assign_angles ( MetaData DF,
const ParametersProjection prm 
)

Assign angles from the projection parameters to a Document file. Given a set of projection parameters this function returns a document file with a set of angles according to the specifications. The order in the output document file is rotational, tilting and psi angle.

The assignment can be done from another document file (with any angle order) or internally generated according to the ranges defined in the parameters.

The total number of angles is returned. The Document File is cleared, the first key in the document file is the starting key of the projection set. The current line of the document file is set to the beginning of the file.

◆ PROJECT_Effectively_project()

int PROJECT_Effectively_project ( const FileName fnOut,
bool  singleProjection,
int  projType,
const ParametersProjection prm,
PROJECT_Side_Info side,
const Crystal_Projection_Parameters prm_crystal,
Projection proj,
MetaData SF 
)

Effectively project. This is the routine which effectively projects, it needs the projection parameters and the side information, ie, the loaded phantom and list of angles from which project. The Projection field will keep at the end the last projection, this is useful in case you want to project only one image, although it is also written to disk. The returned number is the total number of projections generated. A selection file with all images is also returned.

◆ ROUT_project()

int ROUT_project ( ProgProject prm,
Projection proj,
MetaData SF 
)

Main Project routine. Generate a set of projections given the projection parameters. This is the main projecting routine. This function generates a set of projections according to the projecting parameters defined. The projections are written to disk.

The Projection field will keep at the end the last projection, this is useful in case you want to project only one image, although it is also written to disk. The returned number is the total number of projections generated. A selection file with all images is also returned (and saved if any name has been given in the parameters).

Definition at line 1174 of file project.cpp.

1175 {
1177  // Read projection parameters and produce side information
1178  ParametersProjection proj_prm;
1179  PROJECT_Side_Info side;
1180  if (!prm.singleProjection)
1181  proj_prm.from_prog_params(prm);
1182  side.produce_Side_Info(proj_prm, prm);
1183  Crystal_Projection_Parameters crystal_proj_prm;
1184 
1185  side.doCrystal=false;
1186  if (prm.fn_proj_param != "")
1187  {
1188  MetaDataVec MD;
1189  size_t objId;
1190  MD.read(prm.fn_proj_param);
1191  objId = MD.firstRowId();
1192  MD.getValue(MDL_CRYSTAL_PROJ,side.doCrystal,objId);
1193  }
1194  if (side.doCrystal)
1195  {
1196  crystal_proj_prm.read(prm.fn_proj_param,
1197  (side.phantomDescr).phantom_scale);
1198  // if not null read doc file with unitcell shift
1199  // format h, k, shift_X shift_Y shift_Z
1200  if (crystal_proj_prm.DF_shift_bool == true)
1201  crystal_proj_prm.DF_shift.read(crystal_proj_prm.fn_shift);
1202  double my_scale = (side.phantomDescr).phantom_scale;
1203 
1204  for (size_t objId : crystal_proj_prm.DF_shift.ids())
1205  {
1206  double xcell, ycell;
1207  crystal_proj_prm.DF_shift.getValue(MDL_CRYSTAL_CELLX,xcell,objId);
1208  crystal_proj_prm.DF_shift.getValue(MDL_CRYSTAL_CELLY,ycell,objId);
1209  crystal_proj_prm.DF_shift.setValue(MDL_CRYSTAL_CELLX,xcell*my_scale,objId);
1210  crystal_proj_prm.DF_shift.setValue(MDL_CRYSTAL_CELLY,ycell*my_scale,objId);
1211 
1212  double x,y,z;
1213  crystal_proj_prm.DF_shift.getValue(MDL_SHIFT_X,x,objId);
1214  crystal_proj_prm.DF_shift.getValue(MDL_SHIFT_Y,y,objId);
1215  crystal_proj_prm.DF_shift.getValue(MDL_SHIFT_Z,z,objId);
1216  crystal_proj_prm.DF_shift.setValue(MDL_SHIFT_X,x*my_scale,objId);
1217  crystal_proj_prm.DF_shift.setValue(MDL_SHIFT_Y,y*my_scale,objId);
1218  crystal_proj_prm.DF_shift.setValue(MDL_SHIFT_Z,z*my_scale,objId);
1219 
1220  crystal_proj_prm.DF_shift.getValue(MDL_CRYSTAL_SHIFTX,x,objId);
1221  crystal_proj_prm.DF_shift.getValue(MDL_CRYSTAL_SHIFTY,y,objId);
1222  crystal_proj_prm.DF_shift.getValue(MDL_CRYSTAL_SHIFTZ,z,objId);
1223  crystal_proj_prm.DF_shift.setValue(MDL_CRYSTAL_SHIFTX,x*my_scale,objId);
1224  crystal_proj_prm.DF_shift.setValue(MDL_CRYSTAL_SHIFTY,y*my_scale,objId);
1225  crystal_proj_prm.DF_shift.setValue(MDL_CRYSTAL_SHIFTZ,z*my_scale,objId);
1226  }
1227  }
1228 
1229  //#define DEBUG1
1230 #ifdef DEBUG1
1231  if (crystal_proj_prm.DF_shift_bool == true)
1232  crystal_proj_prm.DF_shift.write("DEBUG1_shifts");
1233 #endif
1234 #undef DEBUG1
1235 
1236 
1237  int ProjNo = 0;
1238  if (!prm.only_create_angles)
1239  {
1240  // Really project
1241  if (prm.singleProjection)
1243  proj_prm, side, crystal_proj_prm, proj, SF);
1244  else
1245  {
1246  FileName stackName;
1247  if (prm.fnOut.hasStackExtension())
1248  stackName = prm.fnOut;
1249  else
1250  stackName = prm.fnOut.removeAllExtensions() + ".stk";
1251  FileName mdName = prm.fnOut.removeAllExtensions() + ".xmd";
1252  ProjNo = PROJECT_Effectively_project(stackName, prm.singleProjection, prm.projType,prm.samplingRate,
1253  proj_prm, side, crystal_proj_prm, proj, SF);
1254  SF.setComment("Angles rot,tilt and psi contain noisy projection angles and rot2,tilt2 and psi2 contain actual projection angles");
1255  SF.write(mdName);
1256  }
1257  }
1258  else
1259  if (!prm.singleProjection)
1260  side.DF.write(prm.fnOut.removeAllExtensions()+".xmd");
1261  return ProjNo;
1262 }
void produce_Side_Info(ParametersProjection &prm, ProgProject &prog_prm)
Definition: project.cpp:871
void read(const FileName &fn_crystal, double scale=1.0)
projectionType projType
Type of projection algorithm.
Definition: project.h:81
Cell location for crystals.
void read(const FileName &inFile, const std::vector< MDLabel > *desiredLabels=nullptr, bool decomposeStack=true) override
bool singleProjection
Single projection.
Definition: project.h:69
virtual void write(const FileName &outFile, WriteModeMetaData mode=MD_OVERWRITE) const =0
static double * y
Phantom phantomDescr
Phantom mathematical description.
Definition: project.h:227
Shift for the image in the X axis (double)
void write(const FileName &outFile, WriteModeMetaData mode=MD_OVERWRITE) const
void from_prog_params(const ProgProject &prog_prm)
Definition: project.cpp:183
FileName removeAllExtensions() const
virtual IdIteratorProxy< false > ids()
doublereal * x
virtual void setComment(const String &newComment="No comment")
FileName fnOut
Output filename (used for a singleProjection or a stack)
Definition: project.h:54
bool DF_shift_bool
is doc file with shifts available
Shift for the image in the Z axis (double) for crystals.
MetaDataVec DF_shift
Document File for shifts. Order: H K x_SHIFT y_SHIFT z_SHIFT.
FileName fn_proj_param
Filename with the Projection_Parameters.
Definition: project.h:49
Shift for the image in the Y axis (double) for crystals.
int PROJECT_Effectively_project(const FileName &fnOut, bool singleProjection, projectionType projType, double sampling_rate, const ParametersProjection &prm, PROJECT_Side_Info &side, const Crystal_Projection_Parameters &prm_crystal, Projection &proj, MetaData &SF)
Definition: project.cpp:939
<Orthogonal projection or not (bool)
bool setValue(const MDObject &mdValueIn, size_t id)
< Have a crystal projection (bool)
size_t firstRowId() const override
double z
bool only_create_angles
Only create angles, do not project.
Definition: project.h:67
bool getValue(MDObject &mdValueOut, size_t id) const override
MetaDataVec DF
Document File for the projecting angles. Order: rot, tilt, psi.
Definition: project.h:219
FileName fn_shift
file with shifts
Shift for the image in the Z axis (double)
Shift for the image in the Y axis (double)
unsigned int randomize_random_generator()
bool hasStackExtension() const
double samplingRate
Sampling rate: Only used for PDB projections.
Definition: project.h:63
bool doCrystal
Is this a crystal projection.
Definition: project.h:239
Cell location for crystals.