[Dcmlib] gdcm Examples
Mathieu Malaterre
mathieu.malaterre at kitware.com
Thu Jan 27 22:03:27 CET 2005
gbook wrote:
> I'm new to gdcm, and it looks very promising for the viewer I'm building. I'm
> wondering if there are any sample programs out there that demonstrate how to
> simply read in one dicom volume. I'm not very interested in reading in an
> entire directory, instead just to point to one directory at a time that
> contains a volume (~376 dicom files) and align and recontruct it correctly in
> memory. Any help would be appreciated.
gbook,
MAke sure you are using gdcm fron CVS. Even if is not tag/branch right
now it is pretty much the 1.0 release. You shouldn't start using 0,4 as
you'll have a lot of problem trying to upgrade to anything after that.
Anyway if you follow instructions from:
http://www.creatis.insa-lyon.fr/Public/Gdcm/Cvs.html
You'll get both a directoy called Example and one called Test. Where
you'll find a lot of different ways to use the library to achieve
different goals (Writing a Dicom. creating a new DICOM from scratch,
copying DICOM fields, you name it ... )
Anyway I guess the Hello World for gdcm should be something like:
#include <gdcm.h>
int main(int argc, char *argv[])
{
if( argc != 2 ) return 1;
std::string filename = argv[1];
gdcm::Header h( filename );
h.Print();
return 0;
}
HTH
Mathieu
More information about the Dcmlib
mailing list