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