Skip to content

Part 2: Calculating Features

Daniel Goodwin edited this page Dec 2, 2015 · 13 revisions

Running CalculateDescriptorsForTileAtIndices.m

In the home page we identified six elements to this process. The first two are handled in the Part 1 link

  1. It is up the user to give a best effort of cropping, zooming and rotating the various experiments by hand, then placing the data into the folder in the right format

Handled in this section:

  1. The images volume is partitioned into subvolumes for parallelization and robustness checking in later steps.
  2. Keypoints and feature descriptors are calculated per subvolume
*** Explained in [Step 3 link](https://github.com/dgoodwin208/Registration/wiki/Step-1:-Data-Pre-Processing)
  1. Correspondence calculations per subvolume
  2. Affine transformation are calculated on random subsets of the correspondences
  3. Non-linear transform applied across the entire sample using the validated correspondences

Step 3: Partitioning the Data

The code in this repository treats subvolumes independently until the final step of calculating the Thin Plate Spline. This is done both for parallelization (explained below ) and for calculating affine transforms to validate quality of keypoint correspondences.

The uniform partitions are defined in loadExperimentParams.m in two sets as params.COLS_DESC and params.COLS_TFORM. The DESC variables This allows the user to change the number of pieces under which the descriptors are calculated to vary the parallelism, and the TFORM variables are used to vary the resolution of the affine transforms. That is, if the TFORM parameters are too course, it might not be possible to find suitable affine transforms and so many legitimate point correspondences may be erroneously thrown out. Alternatively, if the user sets the TFORM params too fine, there might not be enough keypoints to properly assess good correspondences.

By default, the values in loadExperimentParams.m are set as the following, which worked fine for the images in Murray et al 2015. These images were on the order of 4000x3000x100 voxels.

%how many subsections to calculate the descriptors?
params.ROWS_DESC = 5;
params.COLS_DESC = 5;
%over how many subsections to calculate the piecewise affine transforms?
params.ROWS_TFORM = 5;
params.COLS_TFORM = 5;

Step 4: Calculating Keypoints and Descriptors

If you call CalculateDescriptorsForTileAtIndices(x) it should just work! (where x is the index of the particular experiment you want to process).

If you want to calculate the descriptors on a subset of the subvolumes, either refer to the documentation or the parallelization section below.

Once you have set up your data in the proper format as described in Step 1, the first computational step to do on the data is to locate and describe "interesting" points in the image. This is done with the a 3D Harris Corner Detector (Original paper) and CalculateDescriptorsForTileAtIndices(run_num,[start_idx,end_idx]) [indicates optional]

fullfile(params.INPUTDIR,sprintf('%sround%d_%s.tif',... params.SAMPLE_NAME,run_num,params.REGISTERCHANNEL));

Output

The descriptors will output a file that is named for the x_y_width_height.mat of the subvolume processed: For example: 739-924_1-208.mat Inside this file

Parallelization:

It is computationally expensive to calculate the 3D Harris Corners keypoints and to identify the most distinctive points via 3D SIFT. Fortunately, the process is embarrassingly parallel. The CalculateDescriptorsForTileAtIndices(run_num,[start_idx,end_idx]) function allows you to specify which of the subvolumes you'd like to operate on. This allows for parallelization to occur via your method of choice - such as on a cluster with bash scripts or using MATLAB's Parallel Toolbox. If you do have access

parpool(); % spawn MATLAB parallel pool with the max number of cores
loadExperimentParams; % management file for the code system
experiment_number_to_process = 1; % pick your experimental round to process
parfor i = 1:params.ROWS_DESC*params.COLS_DESC
    CalculateDescriptorsForTileAtIndices(experiment_number_to_process ,i,i);
end

Clone this wiki locally