how can cropped subvolume containing all voxels that have intensity in the interval [-100,200]HU from 3D ct images
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
alaa shamasneh
el 4 de Ag. de 2016
Comentada: Walter Roberson
el 4 de Ag. de 2016
how can crooped subvolume containing all voxels that have intensity in the interval [-100,200]HU from 3D ct images
0 comentarios
Respuesta aceptada
Walter Roberson
el 4 de Ag. de 2016
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 comentarios
Walter Roberson
el 4 de Ag. de 2016
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()
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!