Page 1 of 1

Reading DICOM for first time users

Posted: 2018-04-11T10:09:15-07:00
by JoelThan89
Hi, I'm a first time user of ImageMagick. I've read only several threads that it is possible to read dicom files and defineSet() must be used.

How should I fill in defineSet? It says the type, key, flag.

so should it be? My issue is what should xx, yy, zz values should be?

Image image;
image.defineSet(xx,yy,zz);
Image.read("test.dcm);

Re: Reading DICOM for first time users

Posted: 2018-04-11T10:40:06-07:00
by snibgo

Re: Reading DICOM for first time users

Posted: 2018-04-11T12:00:00-07:00
by fmw42
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown



Are you using the command line or API? If the latter which one?

Re: Reading DICOM for first time users

Posted: 2018-04-11T20:22:33-07:00
by JoelThan89
Hi,

My IM version is ImageMagick-7.0.7-Q16. I'm implementing Magick++ in Visual Studio 2017 (C++). The code i've been trying to execute is below; However i've read threads that defineSet(). Appreciate any help for novices like me. Thanks.

Code: Select all

#include <Magick++.h>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
    // Read image file from disk
    Image image( "DCM0000.dcm" );
    return 0;
}

Re: Reading DICOM for first time users

Posted: 2018-04-11T21:17:51-07:00
by snibgo
JoelThan89 wrote:However i've read threads that defineSet().
Where have you read this?

After reading the image, have you tried writing it to another format, eg PNG?

Re: Reading DICOM for first time users

Posted: 2018-04-11T21:51:42-07:00
by JoelThan89
When trying to read i've got an error.
code

Code: Select all

#include <Magick++.h> 
#include <iostream> 

using namespace std;
using namespace Magick;

int main(int argc, char **argv)
{
	// Initialise ImageMagick library
	InitializeMagick(*argv);
		Image image("DCM0000.dcm");
	return 0;
}
error

Code: Select all

Unhandled exception at 0x000007FEFD2CA06D in Project6.exe: Microsoft C++ exception: Magick::ErrorCorruptImage at memory location 0x00000000001BF070.
I think the problem is memory related?

The defineSet() mentioned was from an old post below

Re: Reading DICOM for first time users

Posted: 2018-04-11T22:56:01-07:00
by snibgo
I suggest you catch exceptions within your program. Otherwise, we can only guess what the problem is. There are loads of examples in the source distribution -- see "try" and "catch".

I can read a DCM file with no problems in a Magick++ program, with no defines.

Re: Reading DICOM for first time users

Posted: 2018-04-12T02:10:25-07:00
by JoelThan89
Hi everyone, i've just realised my dicom file is corrupted and now works with another dicom file. Thanks for the help everyone