[Insight-users] Read Write Program
Jon Haitz Legarreta
jhlegarreta at vicomtech.org
Wed Nov 2 10:46:31 EDT 2011
Dear Fari,
concerning the linking error, it looks like your project does not know
where your ITK libraries are located. Make sure that your CMakeLists.txt
contains the appropriate reference to the location of the ITK libraries, or
either you can setup the linking properties in MS Visual Studio.
Concerning the names of the IO images, you should include input arguments
in you main method so that you can enter some names for your files and your
program can have access to these variables:
This may be of help:
int main( int argc, char* argv[] )
{
// Typedefs
typedef itk::Image< PixelType, Dimension > InputImageType ; // Choose
the PixelType and Dimension that best fit your problem
typedef itk::Image< PixelType, Dimension > OutputImageType ; // Choose
the PixelType and Dimension that best fit your problem
typedef itk::ImageFileReader< InputImageType > ReaderType;
typedef itk::ImageFileWriter< OutputImageType > WriterType;
// Objects
ReaderType::Pointer reader =
ReaderType::New();
WriterType::Pointer writer =
WriterType::New();
// Other things you need
reader->SetFileName( argv[1] );
writer->SetFileName( argv[2] );
// Your process
return EXIT_SUCCESS;
}
You can enter the names of the input arguments both when executing the
command line or when executing in MS Visual Studio as the input parameters
for execution in your project properties.
Best regards,
JON HAITZ
On 2 November 2011 15:24, faba <faba_ir at yahoo.com> wrote:
> Dear Friends:
> I am trying to generate a simple program that read a jpep image and write
> it
> with another name. Cmake can configure and generate the project with no
> problem, but when I want to build it in MS Visual C++ 2008, it gives me
> lots
> of compilation errors. My questions are that:
> 1- what is the cause of errors?
> 2- What should I do, if I want to declare the name of input image
> (cameraman_old.jpg) and output images (cameraman_new.jpg) as two inputs of
> the program (and not to mentioned inside the program)?
> Attached you can see my simple program and compilations errors.
>
> Your helps are really appreciated
> Fari
>
>
>
> -- http://itk-insight-users.2283740.n2.nabble.com/file/n6955425/2.jpg
> -- http://itk-insight-users.2283740.n2.nabble.com/file/n6955425/1.jpg
>
> --
> View this message in context:
> http://itk-insight-users.2283740.n2.nabble.com/Read-Write-Program-tp6955425p6955425.html
> Sent from the ITK Insight 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.html
>
> 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://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111102/a050a8ff/attachment.htm>
More information about the Insight-users
mailing list