Jörg, here's a small program to show what I'm trying to do:
Code: Select all
#include <dcmtk/config/osconfig.h>
#define INCLUDE_CSTDLIB
#define INCLUDE_CSTDIO
#define INCLUDE_CSTRING
#include "dcmtk/ofstd/ofstdinc.h"
#include "dcmtk/dcmdata/dcistrmb.h"
#include "dcmtk/dcmdata/dcdict.h"
#include <dcmtk/dcmdata/dcfilefo.h>
using namespace std;
int main(int argc, char *argv[])
{
FILE *f;
int const MAX_FILE_SIZE = 8192;
void * buffer[MAX_FILE_SIZE];
int buflen;
if(argc == 1) {
cerr << "Please provide a file." << endl;
return 0;
};
f = fopen(argv[1], "rb");
if (f)
{
buflen = fread(buffer, MAX_FILE_SIZE, 1, f);
DcmInputBufferStream dataBuf;
dataBuf.setBuffer(buffer, buflen);
dataBuf.setEos();
DcmFileFormat fileFormat;
fileFormat.transferInit();
OFCondition cond = fileFormat.read(dataBuf, EXS_Unknown, EGL_noChange, buflen);
fileFormat.transferEnd();
cout << "Result: " << cond.text() << endl;
cout << "Dump: " << endl;
fileFormat.print(cout);
}
else
{
cout << "Error opening file " << argv[1] << endl;
}
}
I truncated an XA file to 128k using this command:
This is the output of ./dumpbuffer file.dcm:
Code: Select all
Result: End of stream
Dump:
# Dicom-File-Format
# Dicom-Meta-Information-Header
# Used TransferSyntax: Little Endian Explicit
# Dicom-Data-Set
# Used TransferSyntax: Unknown Transfer Syntax
Do you know why there's no dicom tag shown?.
P.s.: Compiled against 3.6.0.