Skip to content

Commit

Permalink
fixed a minor bug in the -save-progress and -load-progress arguments.…
Browse files Browse the repository at this point in the history
… Updated some documentation.
  • Loading branch information
jewettaij committed Sep 11, 2021
1 parent b9564ca commit 2bfc0be
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 30 deletions.
4 changes: 2 additions & 2 deletions bin/filter_mrc/filter_mrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ using namespace std;


string g_program_name("filter_mrc");
string g_version_string("0.29.17");
string g_date_string("2021-9-10");
string g_version_string("0.29.18");
string g_date_string("2021-9-11");



Expand Down
2 changes: 1 addition & 1 deletion bin/filter_mrc/handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ HandleTV(const Settings &settings,
}
}
}
cerr << " -- sorting ALL voxels by ridge saliency --\n" << endl;
cerr << " -- sorting all voxels by ridge saliency --\n" << endl;
vector<float> saliencies(n_voxels);
size_t i = 0;
for (int iz=0; iz < image_size[2]; iz++) {
Expand Down
6 changes: 6 additions & 0 deletions bin/filter_mrc/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ Settings::ParseArgs(vector<string>& vArgs)
// Now save all the current command line arguments into the INFO file.
fstream f;
f.open(save_intermediate_fname_info, ios::out);
if (! f)
throw VisfdErr("Error: Unable to open \"" +
save_intermediate_fname_info +"\" for writing.\n");
for (int j = 1; j < vArgs.size(); j++) {
if ((j == i) || (j == i+1))
continue; // omit the "-save-progress filename" arguments
Expand Down Expand Up @@ -324,6 +327,9 @@ Settings::ParseArgs(vector<string>& vArgs)
// Now load the arguments that were in the INFO file.
fstream f;
f.open(load_intermediate_fname_info, ios::in);
if (! f)
throw VisfdErr("Error: Unable to open \"" +
load_intermediate_fname_info +"\" for reading.\n");
vector<string> new_args;
string line;
while (getline(f, line, '\n'))
Expand Down
59 changes: 34 additions & 25 deletions doc/doc_filter_mrc.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,45 @@ filter_mrc -in tomogram.rec \
-connect 1.0e+09 -connect-angle 15 \
-select-cluster 1 -normals-file largest_membrane_pointcloud.ply
```
Note:
This will generate a new file ("largest_membrane_pointcloud.ply")
containing a list of points located on the largest surface.
You can use
[*SSDRecon*](https://github.com/mkazhdan/PoissonRecon)
to load this file and close the holes in the surface. (See below.)

**Note:**
Here I assumed that the user has already followed the instructions in
[example 1](#Example-1). (Consequently, to save time, we used the
["-load-progress"](#-load-progress-FILENAME)
to argument to skip over the time consuming
process of detecting the membrane again.)
This will generate a new file ("largest_membrane_pointcloud.ply")
containing a list of points located on the largest surface. You can use
[*SSDRecon*](https://github.com/mkazhdan/PoissonRecon)
to load this file and close the holes in the surface:

**Note:**
All of these parameters make reasonably good
defaults for membrane detection except the
["**-connect**"](#-connect-threshold)
parameter ("1.0e+09" in the example).
It must be chosen carefully because it will vary from image to image.
Strategies for choosing this parameter are discussed
[below](#determining-the--connect-threshold-parameter).
Repeat the step above with different parameters until the resulting
"membranes_clusters.rec" shows that the different surface fragments
have merged into larger surfaces correctly.
(Verify this by opening the file in 3dmod, clicking on different portions
of the dark surface that you care about, pressing the "F" key each time,
and checking that the resulting ID numbers match.)
If a suitable parameter can not be found that merges the membrane
fragments togethe, you can also use the
["**-must-link**"](#-must-link-FILE)
argument to manually force connections between
disconnected surface fragments. (See below.)
You can also *modify* the image to erase or mask problematic regions (using the
[-draw-spheres](#-draw-spheres-filename), or
[-mask-rect-subtract](#-mask-rect-subtract-xmin-xmax-ymin-ymax-zmin-zmax), and
[-mask-sphere-subtract](#-mask-sphere-subtract-x0-y0-z0-r) arguments).

Now use [*SSDRecon*](https://github.com/mkazhdan/PoissonRecon)
to load the PLY file we just created and close the holes in the surface:
```
SSDRecon --in largest_membrane_pointcloud.ply \
--out largest_membrane.ply --depth 12 --scale 2.0
Expand Down Expand Up @@ -251,26 +280,6 @@ filter_mrc -i segmented.rec -o segmented_interior.rec -erosion 50.0
to see what works best.)



**Note:**
All of these parameters make reasonably good
defaults for membrane detection except the
["**-connect**"](#-connect-threshold)
parameter ("1.0e+09" in the example).
It must be chosen carefully because it will vary from image to image.
Use the "-load-progress FILENAME" argument to save time
while experimenting with different thresholds.
Strategies for choosing this parameter are discussed
[below](#determining-the--connect-threshold-parameter).
If a suitable parameter can not be found, you can also use the
["**-must-link**"](#-must-link-FILE)
argument to manually force connections between
disconnected regions. (See below.)
You can also *modify* the image to erase or mask problematic regions (using the
[-draw-spheres](#-draw-spheres-filename), or
[-mask-rect-subtract](#-mask-rect-subtract-xmin-xmax-ymin-ymax-zmin-zmax), and
[-mask-sphere-subtract](#-mask-sphere-subtract-x0-y0-z0-r) arguments).

Note:
If the resulting surface is *not closed*,
then try increasing the "--scale" parameter.
Expand Down
4 changes: 2 additions & 2 deletions lib/mrc_simple/mrc_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void MrcSimple::Read(string in_file_name,
fstream mrc_file;
mrc_file.open(in_file_name, ios::binary | ios::in);
if (! mrc_file)
throw MrcfileErr("Error: unable to open \""+ in_file_name +"\" for reading.\n");
throw MrcfileErr("Error: Unable to open \""+ in_file_name +"\" for reading.\n");
// Try to infer signed-vs-unsigned integers from the file name:
//http://www.cgl.ucsf.edu/pipermail/chimera-users/2010-June/005245.html
if ((len_in_file_name > 4)
Expand Down Expand Up @@ -354,7 +354,7 @@ void MrcSimple::Write(string out_file_name) {
fstream mrc_file;
mrc_file.open(out_file_name, ios::binary | ios::out);
if (! mrc_file)
throw MrcfileErr("Error: unable to open \""+ out_file_name+"\" for writing.\n");
throw MrcfileErr("Error: Unable to open \""+ out_file_name+"\" for writing.\n");
Write(mrc_file); // You can also use "mrc_file << tomo;"
mrc_file.close();
}
Expand Down

0 comments on commit 2bfc0be

Please sign in to comment.