All other questions regarding DCMTK
Moderator: Moderator Team
juan_7_89
Posts: 15 Joined: Sat, 2013-06-15, 05:52
#1
Post
by juan_7_89 » Tue, 2013-06-25, 18:23
Hello! I don't know how to do it. Can anyone help me?
This is my code:
//NOMBRE DEL PACIENTE!
OFString Nombre_P;
//tratamos de recuperar el nombre del paciente
if (FileFormat.getDataset()->findAndGetOFString(DCM_PatientName, Nombre_P).good())
{
cout << "Nombre del paciente: " << Nombre_P << endl;
} else
cerr << "Error: No se puede acceder al nombre del paciente!" << endl;
string nombre=Nombre_P;
//or
//string nombre(Nombre_P);
Thanks
J. Riesmeier
DCMTK Developer
Posts: 2517 Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:
#2
Post
by J. Riesmeier » Tue, 2013-06-25, 18:29
Are you talking about std::string? Compile with HAVE_STD_STRING and OFString is identical to this class. See
macros.txt for details.
juan_7_89
Posts: 15 Joined: Sat, 2013-06-15, 05:52
#3
Post
by juan_7_89 » Tue, 2013-06-25, 18:50
Yes i'm talking about that!
But if a use that i get errors with this funcion:
FileFormat.getDataset()->findAndGetOFString(DCM_PatientID,ID_P)
undefined reference to 'DcmItem::findAndGetOFString(DcmTagKey const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long, bool)'
J. Riesmeier
DCMTK Developer
Posts: 2517 Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:
#4
Post
by J. Riesmeier » Tue, 2013-06-25, 19:11
Did you recompile the entire DCMTK (after "make clean")?
juan_7_89
Posts: 15 Joined: Sat, 2013-06-15, 05:52
#5
Post
by juan_7_89 » Thu, 2013-06-27, 18:12
What do you mean with recompile the entire DCMTK?
I have only add -DHAVE_STD_STRING to the flags.
This is my makefile:
GPP=g++
GCC=gcc
FLAGS= -fshow-column -g2 -Wall -O0 -Wall -pedantic-errors -DHAVE_CONFIG_H -DHAVE_STD_STRING -O0 -D_DEBUG
LIBS= -L/usr/local/lib -L/usr/local/include -ldcmjpeg -lijg8 -lijg12 -lijg16 -ldcmimgle -ldcmimage -ldcmjpls -ldcmdata -loflog -lofstd -lz -lpthread -lm -lX11
OBJS=Debug/main.o
all: Debug Debug/ImgDicom.bin
clean:
rm -rf ${OBJS} Debug/ImgDicom.bin
Debug/ImgDicom.bin: ${OBJS}
${GPP} ${OBJS} ${LIBS} -o $@
Debug:
mkdir Debug
Debug/main.o: main.cpp imgDicom.cpp imgDicom.h
${GPP} ${FLAGS} -c main.cpp -o $@
J. Riesmeier
DCMTK Developer
Posts: 2517 Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:
#6
Post
by J. Riesmeier » Thu, 2013-06-27, 18:17
With "recompile" I mean: Specify the additonal compiler flag and compile the entire DCMTK from scratch, i.e. create all the DCMTK libraries from source code.
juan_7_89
Posts: 15 Joined: Sat, 2013-06-15, 05:52
#7
Post
by juan_7_89 » Thu, 2013-06-27, 18:33
Thanks, I understand now.
I'm new in this. How do i specify the aditional compiler flag? I don't know where i have to do it.
J. Riesmeier
DCMTK Developer
Posts: 2517 Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:
#8
Post
by J. Riesmeier » Thu, 2013-06-27, 18:49
After running ./configure, you should add "-DHAVE_STD_STRING" to the file "config/Makefile.def" and then recompile.
juan_7_89
Posts: 15 Joined: Sat, 2013-06-15, 05:52
#9
Post
by juan_7_89 » Thu, 2013-10-31, 22:39
I know it's a bit late but thanks.
Do you mean CPPFLAGS =-DHAVE_STD_STRING?
Thank you again.
J. Riesmeier
DCMTK Developer
Posts: 2517 Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:
#10
Post
by J. Riesmeier » Fri, 2013-11-01, 09:09
No, I meant you should add the define to "GLOBALDEFS =" in the "dcmtk/config/Makefile.def".
Users browsing this forum: No registered users and 1 guest