Many of our datasets are too large to be processed efficiently in their native format. Cropping is the preferred method for reducing size as it maintains the spatial resolution of the scan. Scan through the slices to determine a good bounding box for the object in the scan. Test your crop using the `convert` utility provided by ImageMagick. The following command creates a 9060x1794 image starting at pixel (670,830) in the `full_slice_0000.tif` input image:
If the slices come from individual slabs, they must be merged together into a single volume.
Review the resulting test image to ensure that the crop looks correct. When you are satisfied with your crop settings, you can mass crop your images using the `mogrify` command. **Warning:** By default, `mogrify` will modify images in-place. Be sure you have properly specified the `-path` argument to avoid data loss:
Then, the merge itself can be performed using `merge_slabs.py`:
While `mogrify` is certainly the easiest way to mass crop images, it is not the most efficient as the images will be cropped sequentially. For bulk cropping of a large numbers of slices, we recommend using ImageMagick combined with GNU Parallel:
Submitted batch job 1502493
Taking slices 0 to 1548 from slab full_recon_row_005_scan_91875_91876
```shell
Taking slices 0 to 1548 from slab full_recon_row_004_scan_91873_91874
# Make a cropped directory and crop slices in parallel
Taking slices 0 to 1547 from slab full_recon_row_003_scan_91871_91872
mkdir-p cropped/
Taking slices 0 to 1548 from slab full_recon_row_002_scan_91869_91870
If you crop a dataset, please save the crop information into a text file and store it alongside the volume in the Volume Package. The following example matches the above crop command:
If you crop a dataset, please save the crop information into a text file and store it alongside the volume in the Volume Package. The following example matches the above crop command:
...
@@ -117,10 +109,6 @@ Output: cropped/
...
@@ -117,10 +109,6 @@ Output: cropped/
Crop: 9060x1794+670+830
Crop: 9060x1794+670+830
```
```
# Resize volume (optional)
\*\* Coming soon \*\*
# Create .volpkg
# Create .volpkg
If your object does not yet have a Volume Package, use `vc_packager` to create one. New packages require the following flags:
If your object does not yet have a Volume Package, use `vc_packager` to create one. New packages require the following flags:
* If you enabled dump-vis, a new directory called 'debugvis' will appear inside the working directory. Two directories inside, called 'mask' and 'skeleton', contain images that show what is being segmented. You can use these images as a reference to help you determine when to stop the segmentation.
* If you enabled dump-vis, a new directory called 'debugvis' will appear inside the working directory. Two directories inside, called 'mask' and 'skeleton', contain images that show what is being segmented. You can use these images as a reference to help you determine when to stop the segmentation.
To obtain a good-quality segmentation, the mask must cover the majority of the layer of interest, but it is fine if some small parts aren't covered or parts of neighboring pages get segmented too. This is an example of a good-quality segmentation: https://drive.google.com/file/d/1_qzL2L2gZpYHYUJznCZENbsW2ueUj8\\\\\\\_\\\\\\\\\\\\\\\_/view?usp=sharing
To obtain a good-quality segmentation, the mask must cover the majority of the layer of interest, but it is fine if some small parts aren't covered or parts of neighboring pages get segmented too. This is an example of a good-quality segmentation: https://drive.google.com/file/d/1_qzL2L2gZpYHYUJznCZENbsW2ueUj8\\\\\\\\\\\\\\\_\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\_/view?usp=sharing
Check the segmentation occasionally. If a lot of neighboring pages are getting segmented or if the segmentation loses the layer you are segmenting, use Ctrl-C to kill vc_segment **provided you ran vc_segment with `--save interval 1`**.
Check the segmentation occasionally. If a lot of neighboring pages are getting segmented or if the segmentation loses the layer you are segmenting, use Ctrl-C to kill vc_segment **provided you ran vc_segment with `--save interval 1`**.