<div dir="ltr">I don't know what C3DImage, I believe it isn't related to ITK. You have missing dependencies. Probably where the header image3d.h is, there is also a library that you have to link to.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-05-15 15:46 GMT+02:00 Ais <span dir="ltr"><<a href="mailto:lsustc@mail.ustc.edu.cn" target="_blank">lsustc@mail.ustc.edu.cn</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have changed the CMakeList.txt as you say, then I cmake it and creat a<br>
makefile,when I make ,taht notes:<br>
CMakeFiles/LinuxCutImage.dir/src/LinuxCutImage.o: In function `main':<br>
LinuxCutImage.cxx:(.text.startup+0x126): undefined reference to<br>
`C3DImage::C3DImage()'<br>
LinuxCutImage.cxx:(.text.startup+0x13e): undefined reference to<br>
`C3DImage::C3DImage()'<br>
LinuxCutImage.cxx:(.text.startup+0x14e): undefined reference to<br>
`C3DImage::ReadFromITKFile(char*)'<br>
LinuxCutImage.cxx:(.text.startup+0x1c4): undefined reference to<br>
`C3DImage::set_size(int, int, int)'<br>
LinuxCutImage.cxx:(.text.startup+0x1e5): undefined reference to<br>
`C3DImage::set_spacing(float, float, float)'<br>
LinuxCutImage.cxx:(.text.startup+0x357): undefined reference to<br>
`C3DImage::WriteToITKFile(char*)'<br>
<span class="">collect2: error: ld returned 1 exit status<br>
make[2]: *** [LinuxCutImage] Error 1<br>
make[1]: *** [CMakeFiles/LinuxCutImage.dir/all] Error 2<br>
make: *** [all] Error 2<br>
</span>following my LinuxCutImage.cxx<br>
#include <fstream><br>
#include <stdio.h><br>
#include <stdlib.h><br>
#include <time.h><br>
<br>
//#include "SimpleApp.h"<br>
#include "itkExceptionObject.h"<br>
<br>
#include "globaldefinition.h"<br>
#include "commonfunctions.h"<br>
<br>
#include "image3d.h"<br>
<br>
extern int optopt;<br>
extern int optind;<br>
extern char *optarg;<br>
extern int opterr;<br>
<br>
using namespace std;<br>
<br>
void showUsage(char *filename)<br>
{<br>
std::cout << "This program cuts an image." << std::endl;<br>
std::cout << std::endl;<br>
std::cout << "Usage: "<<std::endl;<br>
std::cout<<std::endl;<br>
std::cout<<"program inputimage outputimage bx ex by ey bz<br>
ez"<<std::endl;<br>
std::cout<<std::endl;<br>
std::cout<<"contact: zxue"<<std::endl;<br>
}<br>
<br>
// main program<br>
<br>
int main(int argc, char *argv[])<br>
{<br>
char inputimagefilename[200], outputimagefilename[200];<br>
int bx,ex,by,ey,bz,ez;<br>
<br>
if (argc==9)<br>
{<br>
strcpy(inputimagefilename, argv[1]);<br>
strcpy(outputimagefilename, argv[2]);<br>
sscanf(argv[3], "%d", &bx);<br>
sscanf(argv[4], "%d", &ex);<br>
sscanf(argv[5], "%d", &by);<br>
sscanf(argv[6], "%d", &ey);<br>
sscanf(argv[7], "%d", &bz);<br>
sscanf(argv[8], "%d", &ez);<br>
}<br>
else<br>
{<br>
showUsage(argv[0]);<br>
exit(1);<br>
}<br>
<br>
C3DImage *inputimage, *outputimage;<br>
inputimage = new C3DImage;<br>
outputimage = new C3DImage;<br>
inputimage->ReadFromITKFile(inputimagefilename);<br>
<br>
int XX,YY,ZZ;<br>
<br>
XX = ex-bx+1;<br>
YY = ey-by+1;<br>
ZZ = ez-bz+1;<br>
<br>
if ((XX<1)||(YY<1)||(ZZ<1))<br>
{<br>
cout<<"The small image size you input is not correct."<<endl;<br>
showUsage(argv[0]);<br>
exit(1);<br>
}<br>
<br>
outputimage->set_size(XX,YY,ZZ);<br>
outputimage->set_spacing(inputimage->vsX, inputimage->vsY,<br>
inputimage->vsZ);<br>
<br>
int x,y,z;<br>
int nx,ny,nz;<br>
<br>
for (z=0;z<ZZ;z++)<br>
for (y=0;y<YY;y++)<br>
for (x=0;x<XX;x++)<br>
{<br>
nx = x+bx;<br>
ny = y+by;<br>
nz = z+bz;<br>
if<br>
((nx>=0)&&(ny>=0)&&(nz>=0)&&(nx<inputimage->X)&&(ny<inputimage->Y)&&(nz<inputimage->Z))<br>
{<br>
outputimage->img[nz][ny][nx] = inputimage->img[z][y][x];<br>
}<br>
else<br>
outputimage->img[nz][ny][nx] = -2000;<br>
}<br>
<br>
outputimage->WriteToITKFile(outputimagefilename);<br>
return 0;<br>
}<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://itk-users.7.n7.nabble.com/cannot-find-lITKNumerics-tp35675p35681.html" target="_blank">http://itk-users.7.n7.nabble.com/cannot-find-lITKNumerics-tp35675p35681.html</a><br>
<div class="HOEnZb"><div class="h5">Sent from the ITK - Users mailing list archive at Nabble.com.<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br></div>