Hi Soffiah,
regarding the original image you posted one cannot do more than Sander did. But I guess this is not what is wanted in general: In general - and most likely in your case - one starts using a DICOM image from a CT scanner and wants to get the coordinates of the respective pixels in terms of the CTs coordinate system. So I am going to show a simple example on this:
My original DICOM image (see attachment) I am using below looks like this:
The code:
ClearAll["Global`*"]
(* import data and DICOM header: *)
{{dataRaw}, dcmHdr} = Import[FileNameJoin[{NotebookDirectory[], "CT_img.dcm"}], {{"Data", "MetaInformation"}}];
rs = "RescaleSlope" /. dcmHdr;
ri = "RescaleIntercept" /. dcmHdr;
(* rescaling data (HU i.e."Hounsfield" values) according to DICOM-header: *)
dataHU = dataRaw rs + ri;
(* get image position and pixel spacing *)
{x0Pos, y0Pos, zPos} = "ImagePosition" /. dcmHdr;
pixSpacg = "PixelSpacing" /. dcmHdr;
dataHUimg0 = Image[dataHU];
(* cut all values below 800 HU (e.g. for bones): *)
dataHUimg1 = Closing[Binarize[dataHUimg0, 800], 2];
(* and calculate borders: *)
bbImg = Thinning@Binarize@GradientFilter[dataHUimg1, 1];
(* get pixels: *)
ptsImg = PixelValuePositions[Binarize@bbImg, 1] - 1;
(* calculate true position [mm]: *)
ptsMetric = (pixSpacg # + {x0Pos, y0Pos}) & /@ ptsImg;
Graphics[{Blue, PointSize[.005], Point[ptsMetric]}, Frame -> True, AspectRatio -> Automatic, GridLines -> Automatic, FrameLabel -> {"mm", "mm"}]
The result is:
Maybe you find that interesting/helpful, regards -- Henrik
Attachments: