1
$\begingroup$

the data files I am working with are TIFF stacks, we generate them with a self-written microscope program (in matlab). Among other information, an ASCII value is saved for each image in the TIFF stack and I cannot access it with the Import function of mathematica.

First of all, if I use a free exif reader from the internet (AsTiffTagViewer ver 2.00), i find something like this:

enter image description here

and I am interested in the Tag Code "PageName".

What I have tried in mathematica so far is the following: I run the command

Import["sample26_delaycurve_x00060_z-95_tryout_DS_CH1.tif",{"RawExif"}]

and I get the following output

<|
  "NewSubfileType" -> 2, "ImageWidth" -> 256, "ImageLength" -> 256, 
  "BitsPerSample" -> 32, "Compression" -> 1, "PhotometricInterpretation" -> 2, 
  "StripOffsets" -> 8, "Orientation" -> 1, "SamplesPerPixel" -> 1, 
  "StripByteCounts" -> 262144, "PlanarConfiguration" -> 1, "SampleFormat" -> 3 
|>

This lines up pretty much with the result from the Exif reader (see screenshot), except the last 3 Tag Codes, the codes I am interested in... Mathematica apparently summarizes them into a Tag Code "SampleFormat" with a value of 3.

The TIFF stack can be downloaded here https://1drv.ms/u/s!AlvJm2ZsN8fQmdBFKf_JQg7rKJp1-Q?e=9NYhFv . I appreciate any type of insight - Thanks a lot!

$\endgroup$

1 Answer 1

0
$\begingroup$

Apparently Import simply ignores this tag. It seems to be a bug, please report it to the technical support.

As a workaround you can use third-party command-line utility tiffinfo (I obtained a Windows binary from this page) for extracting the tag information. From Mathematica it can be called using RunProcess:

tiffinfoOut = RunProcess[{"tiffinfo.exe", file}, "StandardOutput"];

Converting the output into a Dataset:

tiffinfo = Dataset[
   Association[#1[[1]] -> 
       Association[Rule @@@ (StringTrim /@ StringSplit[#2, ":", 2])] & @@@ 
     Partition[SplitBy[ImportString[tiffinfoOut, "List"], StringStartsQ["  "]], 2]]];

Requesting the "PageName" column:

tiffinfo[All, "PageName"] // Values

output

As a list:

tiffinfo[All, "PageName"] // Values // Normal
{"t = -3.000000 ps", "t = -2.000000 ps", "t = -1.400000 ps", "t = -0.700000 ps", "t = -0.500000 ps", 
 "t = -0.240000 ps", "t = -0.120000 ps", "t = -0.040000 ps", "t = 0.000000 ps", "t = 0.020000 ps",
 "t = 0.040000 ps", "t = 0.060000 ps", "t = 0.080000 ps", "t = 0.100000 ps", "t = 0.120000 ps",
 "t = 0.140000 ps", "t = 0.160000 ps", "t = 0.180000 ps", "t = 0.200000 ps", "t = 0.220000 ps",
 "t = 0.260000 ps", "t = 0.300000 ps", "t = 0.320000 ps", "t = 0.340000 ps", "t = 0.360000 ps",
 "t = 0.380000 ps", "t = 0.400000 ps", "t = 0.500000 ps", "t = 0.600000 ps", "t = 0.700000 ps",
 "t = 0.800000 ps", "t = 0.900000 ps", "t = 1.000000 ps", "t = 1.100000 ps", "t = 1.400000 ps",
 "t = 1.700000 ps", "t = 2.000000 ps", "t = 2.300000 ps", "t = 2.600000 ps", "t = 2.900000 ps",
 "t = 3.200000 ps", "t = 3.700000 ps", "t = 4.340000 ps", "t = 5.000000 ps", "t = 6.000000 ps",
 "t = 8.010000 ps", "t = 10.010000 ps", "t = 12.010000 ps", "t = 15.340000 ps", "t = 18.680000 ps", 
 "t = 25.350000 ps", "t = 32.020000 ps", "t = 38.689999 ps", "t = 45.360001 ps", "t = 52.040001 ps"}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.