-
Notifications
You must be signed in to change notification settings - Fork 4
Read a DCM file
Raphael Kim edited this page Jul 5, 2017
·
1 revision
- This lecture may help you understand how to read DCM and load it to memory.
- Compiled, or prebuilt library : libtinydicom.a
- Inlcude header file "libDCM.h" in your source code.
- And ability to link libtinydicom.a
- An example DCM file.
- You can read DCM file from your file system.
// decide using namespace of std
using namespace std;
string fileDCM = "LLVM.DCM";
if ( OpenDCM( fileDCM.c_str() ) == true )
{
// Get DICOM tag element count
int elements = GetElementCount();
// Proceed if elements exists.
if ( elements > 0 )
{
// Read DICOM image .
ImageInformation dcmimg = {0};
if ( ImagePixelData( &dcmimg ) == true )
{
printf( "DICOM pixel image information : \n");
printf( "\t- pixel data BPP = %d\n", dcmimg.bpp );
printf( "\t- width x height = %d x %d\n", dcmimg.width, dcmimg.height );
}
else
{
printf( "Failure : No pixel data in DCM.\n" );
}
}
// Let close DCM file handle.
CloseDCM();
}