1234567891011121314151617181920 |
- function v0=extractPixelsFromNrrd(file)
- %extract a nRegion x nx x ny x nz table where
- %each point contained in segmentation corresponds to
- %a row in output table v0
-
- addpath('nrrd_read_write_rensonnet');
- hInfo=nhdr_nrrd_read(file,true);
- v0=zeros(0,4);
- for idx=1:10
- f=find(hInfo.data==idx);
- n=size(f,1)
- if n==0
- continue
- end
- [a,b,c]=ind2sub(size(hInfo.data),f);
- v0=[v0; [idx*ones(n,1) a b c] ];
-
- end
- %switch to zero based matrix addressing
- v0(:,2:4)=v0(:,2:4)-1;
|