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!