how can cropped subvolume containing all voxels that have intensity in the interval [-100,200]HU from 3D ct images
1 回表示 (過去 30 日間)
古いコメントを表示
how can crooped subvolume containing all voxels that have intensity in the interval [-100,200]HU from 3D ct images
0 件のコメント
採用された回答
Walter Roberson
2016 年 8 月 4 日
mask = YourVoxels >= -100 & YourVoxels <= 200;
any1 = any(mask,1);
any12 = any(any1, 2);
start_pane = find( any12, 1, 'first');
end_pane = find( any12, 1, 'last');
any13 = any(any1, 3);
start_col = find( any13, 1, 'first');
end_col = find( any13, 1, 'last');
any23 = any(any( mask, 2), 3);
start_row = find( any23, 1, 'first');
end_row = find( any23, 1, 'last');
sub_volume = YourVoxels(start_row : end_row, start_col : end_col, start_pane : end_pane );
Alternately,
mask = YourVoxels >= -100 & YourVoxels <= 200;
rinfo = regionprops( double(mask), 'BoundingBox');
bb = rinfo.BoundingBox;
sub_volume = YourVoxels(bb(1) : bb(1) + bb(4) - 1, bb(2) : bb(2) + bb(5) - 1, bb(3) : bb(3) + bb(6) - 1);
Or if you want that more verbosely:
mask = YourVoxels >= -100 & YourVoxels <= 200;
rinfo = regionprops( double(mask), 'BoundingBox');
bb = rinfo.BoundingBox;
start_row = bb(1);
end_row = bb(1) + bb(4) - 1;
start_col = bb(2);
end_col = bb(2) + bb(5) - 1;
start_pane = bb(3);
end_pane = bb(3) + bb(6) - 1;
sub_volume = YourVoxels(start_row : end_row, start_col : end_col, start_pane : end_pane );
2 件のコメント
Walter Roberson
2016 年 8 月 4 日
My first version works without changes.
The second version should be
mask = YourVoxels >= -100 & YourVoxels <= 200;
rinfo = regionprops( double(mask), 'BoundingBox');
bb = ceil(rinfo.BoundingBox);
sub_volume = YourVoxels(bb(2) : bb(2) + bb(5) - 1, bb(1) : bb(1) + bb(4) - 1, bb(3) : bb(3) + bb(6) - 1);
The image you posted is not a 3D CT image: it is a 2D slice of a CT image that has had its values shifted and scaled, and then it has been blurred (by saving as JPEG.) The YourVoxels array that you should be using is the data that you get from dicomread()
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!