Get information about a stack of images, without plotting it

You can use ImageDimensions for this purpose (in this case for a multi-frame DICOM):

imagestack = 

  Import["http://www.barre.nom.fr/medical/samples/files/MR-MONO2-8-\16x-heart.gz"];

Length[imagestack]

ImageDimensions /@ imagestack

(* 16 *)

(* {{256, 256}, {256, 256}, {256, 256}, {256, 256}, {256, 256}, {256, 

  256}, {256, 256}, {256, 256}, {256, 256}, {256, 256}, {256, 

  256}, {256, 256}, {256, 256}, {256, 256}, {256, 256}, {256, 256}} *)

ListAnimate[img]

Mathematica graphics


One can get information about the images in a file from the metadata, provided it is there in the first place.

For example, in Yves Klett's example file, the "MetaInformation" contains information about "FrameCount", "Rows", and "Columns". These can be obtained as follows:

{"FrameCount", "Rows", "Columns"} /.
  Import["http://www.barre.nom.fr/medical/samples/files/MR-MONO2-8-16x-heart.gz",
         "MetaInformation"]
(* {16, 256, 256} *)

One can get the image dimensions of the frames from the element "ImageSize", too:

Import["http://www.barre.nom.fr/medical/samples/files/MR-MONO2-8-16x-heart.gz",
       "ImageSize"]
(* {256, 256} *)

Tags:

Image