 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
40 cout <<
"Fields: " << nfield << endl;
41 cout <<
"Micrographs: " << nmg <<
" ( " << nmgs <<
" selected)" << endl;
42 cout <<
"Particles: " << npart <<
" ( " << nsel <<
" selected)" << endl;
43 cout <<
"Filaments and nodes: " << nfil <<
" " << nfn << endl;
53 cout <<
"Reconstructions: " << nrec <<
" ( " << nrecs <<
" selected)" << endl;
54 cout <<
"Particles: " << npart <<
" ( " << nsel <<
" selected)" << endl;
55 cout <<
"Filaments and nodes: " << nfil <<
" " << nfn << endl;
64 if ( filename.
length() < 1 )
return 0;
72 cout <<
"DEBUG field_resolve_file_access: file=" << filename <<
" path=" << path << endl;
74 for ( ; field; field = field->
next ) {
75 if ( !mg ) mg = field->
mg;
76 for ( ; mg; mg = mg->
next ) {
84 for ( part = mg->
part; part; part = part->
next )
95 if ( filename.
length() < 1 )
return 0;
103 cout <<
"DEBUG reconstruction_resolve_file_access: file=" << filename <<
" path=" << path << endl;
105 for ( ; rec; rec = rec->
next ) {
111 for ( part = rec->
part; part; part = part->
next )
120 if ( filename.
length() < 1 )
return 0;
155 if ( filename.
empty() ) {
156 error_show(
"No micrograph parameter filename!", __FILE__, __LINE__);
163 cout <<
"Parameter filename: " << filename << endl;
175 }
else if ( ext.
contains(
"imod") ) {
177 }
else if ( ext.
contains(
"mdoc") ) {
180 cerr <<
"Error: Extension \"" << ext <<
"\" not valid for parameter files!" << endl;
181 cerr <<
" Parameter file \"" << filename <<
"\" not read." << endl;
212 error_show(
"No micrograph parameter filename!", __FILE__, __LINE__);
220 cout <<
"Reading parameter files:";
221 for ( thisfile = file_list; thisfile; thisfile = thisfile->
next )
222 cout <<
" " << *thisfile;
235 }
else if ( ext.
contains(
"mdoc") ) {
237 }
else for ( thisfile = file_list; thisfile; thisfile = thisfile->
next ) {
239 if ( field )
for ( mg = field->
mg; mg && mg->
next; mg = mg->
next ) ;
249 cerr <<
"Error: Extension \"" << ext <<
"\" not valid for parameter files!" << endl;
250 cerr <<
" Parameter file \"" << *thisfile <<
"\" not read." << endl;
258 if ( !mg ) mg = field->
mg;
293 for ( mg = field->
mg; mg; mg = mg->
next, nmg++ ) ;
294 if ( project_append && !field->
next ) {
296 project_append->
field = NULL;
298 project_append = NULL;
307 #if defined(HAVE_XML)
337 int mg_select,
int rec_select)
340 if ( mg_select ) flags |= 2;
341 if ( rec_select ) flags |= 4;
362 int mg_select(flags & 2), rec_select(flags & 4);
376 if ( filename.
empty() )
377 return error_show(
"No micrograph parameter filename!", __FILE__, __LINE__);
382 cout <<
"Writing parameter file: " << filename << endl;
390 }
else if ( ext.
contains(
"imod") ) {
393 cerr <<
"Error: Extension \"" << ext <<
"\" not valid for parameter files!" << endl;
394 cerr <<
" Parameter file \"" << filename <<
"\" not written." << endl;
408 #if defined(HAVE_XML)
417 Bstring filename =
"ppx/" +
id +
"_" +
Bstring(part_id,
"%04d") +
".ppx";
428 else if ( part->
rec )
431 if ( access(filename.
c_str(), R_OK) == 0 )
435 if ( flag == exist + 1 )
436 cout << part->
sel <<
tab << filename << endl;
447 else if ( part->
rec )
450 if ( access(filename.
c_str(), R_OK) )
486 cout <<
"DEBUG project_check: " << endl;
492 for ( mg=field->
mg; mg; mg=mg->
next ) {
494 cout <<
"DEBUG project_check: mg=" << mg->
id << endl;
499 cout <<
"Resetting micrograph ID: " << mg->
id << endl;
503 cout <<
"Resetting micrograph ID: " << mg->
next->
id << endl;
517 cerr <<
"Warning: Resetting pixel size for micrograph " <<
532 for ( part = mg->
part; part; part = part->
next ) {
534 cerr <<
"Error: Particle has an ID less than 1! (" << mg->
id <<
")" << endl;
536 if ( part_file.
length() && part_file != part->
fpart ) part_file = 0;
544 if ( part_file.
length() ) {
545 mg->
fpart = part_file;
546 for ( part = mg->
part; part; part = part->
next ) part->
fpart = 0;
549 for ( j=0, bad = mg->
bad; bad; bad = bad->
next ) bad->
id = --j;
562 cout <<
"Resetting reconstruction ID: " << rec->
id << endl;
566 cout <<
"Resetting reconstruction ID: " << rec->
next->
id << endl;
575 for ( part = rec->
part; part; part = part->
next ) {
577 cerr <<
"Error: Particle has an ID less than 1! (" << mg->
id <<
")" << endl;
585 for ( j=0, bad = rec->
bad; bad; bad = bad->
next ) bad->
id = --j;
592 if ( ( flags & 1 ) && field ) {
623 cout <<
"Searching for file " << fn << endl;
627 for ( mg = field->
mg; mg; mg = mg->
next ) {
629 if ( mg->
fpart == fn )
return part;
630 for ( ; part; part = part->
next )
631 if ( part->
fpart == fn )
return part;
637 if ( rec->
fpart == fn )
return part;
638 for ( ; part; part = part->
next )
639 if ( part->
fpart == fn )
return part;
644 cerr <<
"Error: File " << fn <<
" not found!" << endl;
666 cout <<
"Updating particles from ppx files" << endl;
668 for (
int f=0; f<
NFOM && fom_tag[f]; ++f )
669 cout <<
tab << fom_tag[f];
675 for ( mg = field->
mg; mg; mg = mg->
next )
676 for ( part = mg->
part; part; part = part->
next )
680 for ( part = rec->
part; part; part = part->
next )
685 cout <<
"Number of particles updated: " << npart << endl << endl;
698 long npart(0), nexist(0);
706 cout <<
"Existing ppx files" << endl;
707 else if ( flag == 1 )
708 cout <<
"Absent ppx files" << endl;
713 for ( mg = field->
mg; mg; mg = mg->
next )
714 for ( part = mg->
part; part; part = part->
next, npart++ )
718 for ( part = rec->
part; part; part = part->
next, npart++ )
723 cout <<
"Number of particles: " << npart << endl;
724 cout <<
"Number of ppx files: " << nexist << endl;
725 cout <<
"Number of absent ppx files: " << npart - nexist << endl << endl;
744 long n(1), c, max(0);
753 for ( mg = field->
mg; mg; mg = mg->
next )
754 for ( part = mg->
part; part; part = part->
next )
755 if ( max < part->sel ) max = part->
sel;
758 for ( part = rec->
part; part; part = part->
next )
759 if ( max < part->sel ) max = part->
sel;
763 cout <<
"Splitting into " << max <<
" sets of particles" << endl;
765 for ( n=1; n<=max; n++ ) {
768 for ( mg = field->
mg; mg; mg = mg->
next ) {
770 for ( part = mg->
part; part; part = part->
next )
if ( part->
sel == n ) {
780 for ( mg = field->
mg; mg; mg = mg->
next )
784 for ( part = rec->
part; part; part = part->
next )
if ( part->
sel == n ) {
793 cout <<
"Writing " << fn <<
" with " << c <<
" particles" << endl;
816 Bfield* field, *field_next;
820 field_next = field->
next;
822 project_temp->
field = field;
823 fn = field->
id +
".star";
825 field->
next = field_next;
int project_kill(Bproject *project)
Frees a whole project.
long project_count_mg_particles(Bproject *project)
Counts all the particles in the project structure.
Reads and writes micrograph XML files.
Converts between SerialEM MDOC files and a micrograph parameter file.
int ppx_exists(Bparticle *part, int flag)
int write_particle(Bstring &filename, Bparticle *part, int euler_flag, int omega_flag, FOMType fom_tag[NFOM])
Header file for file checking functions.
Vector3< double > voxel_size
long project_count_fields(Bproject *project)
Counts all the fields in the project structure.
long project_count_rec_filaments(Bproject *project)
Counts the number of filaments in a project.
int project_update_first_zero(Bproject *project)
Updates the first zero from the defocus average for all the micrographs.
long project_count_reconstructions(Bproject *project)
Counts all the reconstructions in the project structure.
Bproject * read_project(const char *filename, int flags)
Reading micrograph parameters from files.
int bexit(int value)
Exit function for cleanup and debugging.
int write_particle_xml(Bstring &filename, Bparticle *part, int euler_flag, int omega_flag, FOMType fom_tag[NFOM])
int error_show(string message, string file, int line)
Displays the error with file and line reference.
Bproject * project_init()
Initializes a micrograph processing project parameter structure.
int project_display_counts(Bproject *project)
int ppx_check(Bparticle *part, FOMType fom_tag[NFOM])
int read_project_xml(Bstring &filename, Bproject *project)
Reading micrograph parameters from XML files.
int write_project_star(const char *filename, Bproject *project, int mg_select, int rec_select)
Writing micrograph parameters to a STAR file.
double length(vector< T > v)
int project_check_particles(Bproject *project)
Checks particle numbers and box sizes.
Converts between IMOD files and a micrograph parameter file.
int write_project(const char *filename, Bproject *project)
Writing micrograph parameters to a file.
Header file for reading and writing micrograph parameters.
long append_project(Bproject *project, Bstring *file_list, Bstring &xsdfile, int flags)
Bstring command_line_time()
Returns the command line and time in a string.
int reconstruction_resolve_file_access(Breconstruction *rec, Bstring filename, int flags)
Bparticle * read_particle_xml(Bstring &filename, Bparticle **partlist, FOMType fom_tag[NFOM])
long project_count_mg_selected(Bproject *project)
Counts all the selected micrographs in the project structure.
long project_count_mg_part_selected(Bproject *project)
Counts the number of particles in a project.
Bstring ppx_filename(Bstring &id, int part_id)
Functions for CTF (contrast transfer function) processing.
long project_count_rec_selected(Bproject *project)
Counts all the selected reconstructions in the project structure.
int project_check(Bproject *project, int flags=0)
Vector3< double > pixel_size
double micrograph_intensity(Bmicrograph *mg)
Gets the average of a micrograph.
Header file for image processing from micrograph structures.
double defocus_deviation()
int read_project_emx(Bstring &filename, Bproject *project, Bstring &xsdfile)
Reading micrograph parameters from XML files.
long project_update_from_ppx(Bproject *project)
Updates a project with ppx files.
Header file for general utilities.
ostream & tab(ostream &out)
int write_project_emx(Bstring &filename, Bproject *project, int mg_select, int rec_select)
Writing micrograph parameters to an EMX file.
Bparticle * read_particle(Bstring &filename, Bparticle **partlist, FOMType fom_tag[NFOM])
long project_count_rec_part_selected(Bproject *project)
Counts all the particles in the project structure.
Reads and writes micrograph exchange files.
Header file for reading and writing micrograph parameters from and to the STAR format.
int project_resolve_file_access(Bproject *project, Bstring filename, int flags)
Header file for micrograph processing.
Bstring find_file(Bstring filename, Bstring path, int flag=0)
Searches for a file within or without the given path.
int project_split_write(Bstring &filename, Bproject *project)
Splits a project into sets of particle selections and write the files.
int write_project_imod(Bstring &imodfile, Bproject *project)
Creates IMOD parameter files from a project structure.
int read_project_imod(Bstring *file_list, Bproject *project, int flag)
Creates a project structure using IMOD parameters.
Vector3< double > pixel_size
int read_project_serialem(Bstring &filename, Bproject *project, int flag)
Creates a project structure using SerialEM MDOC parameters.
int field_resolve_file_access(Bfield *field, Bmicrograph *mg, Bstring filename, int flags)
long project_count_mg_filaments(Bproject *project)
Counts the number of filaments in a project.
bool contains(const Bstring &s)
int particle_kill(Bparticle *part)
Frees a list of particles.
long project_list_ppx(Bproject *project, int flag)
Lists existing ppx files for a project.
int project_split_field_write(Bproject *project)
Splits a project into sets of particle selections and write the files.
int read_project_star(Bstring &filename, Bproject *project)
Reading micrograph parameters from STAR files.
int particle_update(Bparticle *part, Bparticle *nu_part)
Updates one existing particle with new information.
Bparticle * project_find_particle(Bproject *project, Bstring &fn)
Finds a particle associated with a file name.
long project_count_micrographs(Bproject *project)
Counts all the micrographs in the project structure.
int write_project_xml(Bstring &filename, Bproject *project, int mg_select, int rec_select)
Writing micrograph parameters to a XML file.
long project_count_rec_filament_nodes(Bproject *project)
Counts the number of filaments in a project.
long project_count_rec_particles(Bproject *project)
Counts all the particles in the project structure.
long project_count_mg_filament_nodes(Bproject *project)
Counts the number of filament nodes in a project.