Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
usage:advanced_usage [2020/06/24 13:08] – [Custom feature extraction] pseudomoaner | usage:advanced_usage [2022/09/05 23:05] (current) – pseudomoaner | ||
---|---|---|---|
Line 5: | Line 5: | ||
===== Non-standard workflows ===== | ===== Non-standard workflows ===== | ||
- | Although FAST contains all the essential tools for a complete image to track workflow, | + | Although FAST contains all the essential tools for a complete image to track workflow, |
- | The modular design | + | Please note that the majority of these advanced features are only available if you are running the [[setup: |
==== Use of external segmentations ==== | ==== Use of external segmentations ==== | ||
Line 47: | Line 47: | ||
If using the stand-alone version of FAST, functions that can write .mat files from other languages (such as R's [[https:// | If using the stand-alone version of FAST, functions that can write .mat files from other languages (such as R's [[https:// | ||
- | You will also need to provide FAST with the raw images from your dataset. This can be performed using FIJI in a similar way to the the segmentations, | + | You will also need to provide FAST with the raw images from your dataset. This can be performed using FIJI in a similar way to the the segmentations, |
==== Custom feature extraction ==== | ==== Custom feature extraction ==== | ||
- | If there is a novel feature you wish to analyse but which is not natively provided by the [[usage: | + | If there is a novel feature you wish to analyse but which is not natively provided by the [[usage: |
- | <code matlab> | + | <code matlab |
- | function feats = customFeats(inSeg, | + | function feats = customFeats(inSeg, |
%CUSTOMFEATS can be customised to allow extraction of custom features from | %CUSTOMFEATS can be customised to allow extraction of custom features from | ||
%your dataset in the feature extraction module. | %your dataset in the feature extraction module. | ||
Line 65: | Line 65: | ||
% Note: Input segmentation and channel images have been cut from the | % Note: Input segmentation and channel images have been cut from the | ||
% | % | ||
- | % | + | % |
- | % | + | % |
% | % | ||
+ | % | ||
+ | % | ||
% | % | ||
% | % | ||
% | % | ||
- | % are empty, should return a vector of zeros of the same size - this | + | % are empty, should return a vector of zeros of the same size as |
+ | % the output feature vector if these inputs were not empty - this | ||
% is used to initialise storage in the feature extraction engine. | % is used to initialise storage in the feature extraction engine. | ||
% | % | ||
Line 93: | Line 96: | ||
<code matlab> | <code matlab> | ||
+ | |||
+ | function feats = customFeats(inSeg, | ||
+ | %CUSTOMFEATS can be customised to allow extraction of custom features from | ||
+ | %your dataset in the feature extraction module. | ||
+ | % | ||
+ | % | ||
+ | % | ||
+ | % | ||
+ | % | ||
+ | % | ||
+ | % Note: Input segmentation and channel images have been cut from the | ||
+ | % | ||
+ | % | ||
+ | % | ||
+ | % | ||
+ | % | ||
+ | % | ||
+ | % | ||
+ | % | ||
+ | % | ||
+ | % are empty, should return a vector of zeros of the same size as | ||
+ | % the output feature vector if these inputs were not empty - this | ||
+ | % is used to initialise storage in the feature extraction engine. | ||
+ | % | ||
+ | % | ||
+ | |||
+ | %Need to specify the case where both inputs are empty (special case used to | ||
+ | %initialise storage properly) | ||
+ | if isempty(inSeg) && isempty(inChans) | ||
+ | feats = 0; | ||
+ | else | ||
+ | %Skeletonise segmentation to generate cell backbone | ||
+ | backbone = bwskel(logical(inSeg),' | ||
+ | | ||
+ | %If skeleton is very small, implies cell is close to circular. | ||
+ | %Backbone curvature is poorly defined in this case, so set to NaN. | ||
+ | if sum(backbone(: | ||
+ | feats = NaN; | ||
+ | else | ||
+ | %Run circular fitting algorithm. Function available here: https:// | ||
+ | [y,x] = ind2sub(size(inSeg), | ||
+ | | ||
+ | circParams = CircleFitByPratt([x, | ||
+ | | ||
+ | feats = 1/ | ||
+ | end | ||
+ | end | ||
+ | |||
+ | %Swap dimensions of feature vector (if needed) | ||
+ | if size(feats, | ||
+ | feats = feats'; | ||
+ | end | ||
</ | </ | ||
- | By applying this to a mixture of //V. cholerae// and //P. aeruginosa// | + | By applying this to a mixture of //V. cholerae// and //P. aeruginosa// |
+ | |||
+ | {{ : | ||
==== Import of non-segmentable objects ==== | ==== Import of non-segmentable objects ==== | ||
Line 145: | Line 202: | ||
==== Telling FAST about novel features ==== | ==== Telling FAST about novel features ==== | ||
- | Whether you add features through the customFeats.m script or create a new feature structure from scratch, FAST needs to be told some information about the properties of any features not included in its default setup. Please note that any changes that need to be made during this process will involve edits to parts of FAST's core code, and as such cannot be performed in the stand-alone version of FAST. | + | Whether you add features through the customFeats.m script or create a new feature structure from scratch, FAST needs to be told some information about the properties of any features not included in its default setup. |
=== Informing the tracking module === | === Informing the tracking module === | ||
Line 166: | Line 223: | ||
* **Locations** defines the columns in **trackableData** that should be included as separate features. For example, each cell in **trackableData.Centroid** contains an Nx2 matrix of values, with the first column indicating the x-coordinate of the N objects and the second column the y-coordinate. As checking the **Position** box in the tracking module indicates that you wish to include both x and y coordinate data as features, **featureStruct.Centroid.Locations** is set as [1,2]. | * **Locations** defines the columns in **trackableData** that should be included as separate features. For example, each cell in **trackableData.Centroid** contains an Nx2 matrix of values, with the first column indicating the x-coordinate of the N objects and the second column the y-coordinate. As checking the **Position** box in the tracking module indicates that you wish to include both x and y coordinate data as features, **featureStruct.Centroid.Locations** is set as [1,2]. | ||
* **StatsType** defines if your feature is circular or linear. | * **StatsType** defines if your feature is circular or linear. | ||
- | * **Range** only needs to be defined if **StatsType** is set as circular, and sets the ' | + | * **Range** only needs to be defined if **StatsType** is set as circular, and sets the ' |
=== Informing the division detection module === | === Informing the division detection module === |