#!/usr/bin/perl
### marty: dump Siemens ASCII ima header (ASCCONV BEGIN/END can occur in dicom)
# 080707: first hack
# 180508: char[0]'s, "### ASCCONV BEGIN object-MrProt... ###", ulVer whitespace
$\ = "\n";
$pr = 0;
$fl = 0;
if ($#ARGV < 0) { die("use: dumphead <siemens.IMA>\n"); }
open FILE, $ARGV[0] or die $!;
while (<FILE>) {
  chop;
  if (/^### ASCCONV BEGIN /) { $fl = 1; next; }
  if (/^ulVersion/ && $fl eq 1) { $pr = 1; }
  if (/^### ASCCONV END ###/ && $pr eq 1) { exit; }
  if ($pr) { print $_; }
}
