creating_and_combining_masks_from_vtcs
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
creating_and_combining_masks_from_vtcs [2010/06/23 04:10] – two typos... jochen | creating_and_combining_masks_from_vtcs [2010/06/25 18:48] (current) – changed comparison operator to greater or equal jochen | ||
---|---|---|---|
Line 26: | Line 26: | ||
* clear mask object | * clear mask object | ||
- | ===== Code ===== | + | ==== Code ==== |
<code matlab create_msk_from_vtcs.m> | <code matlab create_msk_from_vtcs.m> | ||
% - intensity threshold: values < 10 are treated as relative threshold! | % - intensity threshold: values < 10 are treated as relative threshold! | ||
Line 121: | Line 121: | ||
mdm.ClearObject;</ | mdm.ClearObject;</ | ||
+ | ===== Alternative | ||
+ | In case the MSK files/ | ||
+ | |||
+ | * making settings (i.e. percentage threshold for combined mask) | ||
+ | * locating all mask files to be averaged | ||
+ | * loading all masks and adding the data | ||
+ | * thresholding the data | ||
+ | * saving new mask | ||
+ | |||
+ | ==== Code ==== | ||
+ | <code matlab combine_existing_msks.m> | ||
+ | gthresh = 0.8; | ||
+ | |||
+ | % locate masks | ||
+ | % - this could be enhanced by changing the pattern, e.g. using | ||
+ | % ' | ||
+ | % - additionally, | ||
+ | mskfiles = findfiles(pwd, | ||
+ | % alternative: | ||
+ | |||
+ | % loop over masks | ||
+ | msk = []; | ||
+ | for mc = 1: | ||
+ | |||
+ | % clear old mask | ||
+ | if ~isempty(msk) | ||
+ | msk.ClearObject; | ||
+ | end | ||
+ | |||
+ | % load mask | ||
+ | msk = xff(mskfiles{mc}); | ||
+ | | ||
+ | % for first mask | ||
+ | if mc == 1 | ||
+ | | ||
+ | % copy data | ||
+ | mask = uint16(msk.Mask); | ||
+ | | ||
+ | % otherwise | ||
+ | else | ||
+ | | ||
+ | % add data | ||
+ | mask = mask + uint16(msk.Mask); | ||
+ | end | ||
+ | end | ||
+ | |||
+ | % threshold mask | ||
+ | mask = uint8(mask >= uint16(ceil(gthresh * numel(mskfiles)))); | ||
+ | |||
+ | % store | ||
+ | msk.Mask = mask; | ||
+ | |||
+ | % save | ||
+ | msk.SaveAs; | ||
+ | |||
+ | % clear object | ||
+ | msk.ClearObject;</ |
creating_and_combining_masks_from_vtcs.1277266231.txt.gz · Last modified: 2010/06/23 04:10 by jochen