222AX066 DSHS Expt-4
222AX066 DSHS Expt-4
Metadata
ImageIO reads in data as Image objects. These are standard NumPy arrays with a dictionary of
metadata.
Metadata can be quite rich in medical images and can include:
Plot images:Matplotlib's imshow() function gives you a simple way to do this. Knowing a few
simple arguments will help:
cmaR controls the color mappings for each value. The "gray" colormap is common, but many
others are available.
vmin and vmax control the color contrast between values. Changing these can reduce the
influence of extreme values.
Load volumes
ImageIO's volread() function can load multi-dimensional datasets and create 3D volumes from a
folder of images. It can also aggregate metadata across these multiple images.
For this exercise, read in an entire volume of brain data from the "./dataset/tcia-chest-ct-sample"
folder, which contains 5 DICOM images.
Field of view
The amount of physical space covered by an image is its field of view, which is calculated from
two properties:
CSE(IOT) SIES GST Data Science for Health and Social Care lab
• Array shape, the number of data elements on each axis. Can be accessed with
the shape attribute.
• Sampling resolution , the amount of physical space covered by each pixel. Sometimes
available in metadata (e.g., meta['sampling']).
Advanced plotting
Generate subplots
You can draw multiple images in one figure to explore data quickly. Use plt.subplots() to generate
an array of subplots.
Slice 3D images: The simplest way to plot 3D and 4D images by slicing them into many 2D
frames. Plotting many slices sequentially can create a "fly-through" effect that helps you
understand the image as a whole.
Diet ( [ ( 'Tra nsf ersy ntaxu m ' , '1., 2,. s..e,. 1.em:m.1.. 2 '),
( 'SOf»C:lass D ' , ' 1.2 .. 840.. 10028 .. 5 .1..4 .1..1.2. ' ),
( 'SOPirnst:anc ID ' ,
·1.. 3.6 .. 1.4 .. 1.14519 .5.. 2 .1.. 5168 .. !l..900 .2.9086680737014<680!l..e46392.918.286 ' ),
( 'st: dyD ate ' , '2004e1529 ') ,
( 'seriesDate ' , '20f)t!0 51.5 ' ) ,
( 'caritent::o a e ' , ' 20240515 ' ),
( 'St: dyT· e ' ·' '115200 ' ),
( 'ser iesTi ' , '1152154 ' ),
( 'caritent:Tim e ' , ' 115325 ') ,
( 'Mod a lity' , 'C ' ) ,
( .Man ufacturer .' ' E ME ICAL SVS.TIBMS..)'
( 'st: dyDes cription ' , ' f>iE T c with r.egist:ered r.; ' ),
( • SeriesDescriptiari .' • CT 1C;.G E:S. - RiESEARCH '
)' ( 'Pat ient: am e' , ' STS_087 ' ) ,
( 'Patient:m ' ' 'STS_e07 ' )'
( 'Pat ient:B:i.rt:hDate' , ' ' ),
( 'Pat ient:s.oex ' , ' ' ),
( 'Pat.ien ' eiht ' , s.2. .,
0), ( 'st: d'yinstanceurn '
,
'1,. 3.6 ., 1.4 ., 1.14519 .5,. 2 .1.,. 5168,. !l..900 .3.SB977377904l44816048<% 607e,90 ' ),
( 'seriesllflstanceum ' ,
'1,. 3.6 ., 1.4 ., 1.1 519 .5,. 2 .1.,. 5168,. !l..900. 311547783684032 5822808 3038439 ' ) '
( 'Seriesr · er ' , 2),
( 'Acq uisition uctier ' ,
1), ( 'Instanc m !J.e r ' ·'
57),
( 'ImaPas:i.ti n Pat:ient:' , ( -250 ,.!0, - 250.0, - 180 ., 62)),
( ' Tim aorient:a t ion Patie:nt ' , (1,. 0, 0.0, 0 .0, 0 .0., 1.0, 0., 0)),
( • s- plesPer Pixoe l ' , 1) ,
( ' ·Cfl'IS ', 5:12 ),
( 'Cal s', 51.2),
( 'Pi:>:Jelspa cin,g ' , (!0 .976562 , 0 . 9761562)),
( 'Bits."'-llocat:e.d ' ,
16.) , ( 'Bitsstared ' ,
:16),
( 'H i,gtlB.it: ', 15) ,
( 'Pi:>:Je iqprese:ntat:icn ' , 0 ) ,
( ' es c aleirn tet'cept: ' , - 1.024 ,.
0) , ( ' escales. ope' , 1.0) ,
( 'Pi:>:Je Data ' ,
' Data converted t n . y a r:rey, ra•. data re ved ta prese NJe mory ' ),
0 0
100 100
200 200
300
-
300
400
500
400
500
' Y
'",- - - -- ,/
0 100 200 300 400 500 0 100 200 300 400 500
CSE(IOT) SIES GST Data Science for Health and Social Care lab
volume
# Stack i.mages into a
vol = np .stack([iml, irn2, im3]
axis=0) print ('Volume dimensions:
· vol .sh ape)
In
[
5 11 s ( 20 ,IS 11 s (1
·.
In (J : Plu -- OM u L r
i, axes pl .subplots(l, 5, f 1si e (l5,
IS))
00
25
00
2.5
Conclusion: Biomedical Image Analysis demonstrates the benefits reaped from the
application of digital image processing , computer vision, and pattern analysis techniques to
biomedical images, such as adding objective strength and improving diagnostic confidence
through quantitative anal