[Insight-developers] load data which has fixed dir relationship wrt source

Gao, Yi gaoyi.cn at gmail.com
Tue Nov 9 18:43:10 EST 2010


Dear all,

The email title is confusing....

What I want to do is like this:
In my code, besides the code a.cxx, I also have some image data a.nrrd
which stores the necessary information and will be loaded and used in
running of a.cxx.

Let's assume the dir structure is fixed as:
myProj/src/a.cxx
myProj/data/a.nrrd

Then, how should I confirm a.cxx can find a.nrrd?

I assume that if we do
itkImageReader->SetFileName("../data/a.nrrd");

Then in running the exe of a.cxx, the "../data/a.nrrd" is wrt to the
exe, not the a.cxx, right?

So is there a way for the a.cxx to find a.nrrd no matter where the exe
of a.cxx is?

Probably this can be done with the help of cmake? But I'm not sure....

Thank you for any hint!

Best,
yi


More information about the Insight-developers mailing list