RTKConsortium / RTK

Reconstruction Toolkit
Apache License 2.0
245 stars 145 forks source link

Get an error in First Reconstruction.cxx #611

Closed SS99aaNN closed 3 months ago

SS99aaNN commented 3 months ago

Dear RTK users and developers,

Greetings! I am a student who has just started learning RTK. I downloaded and compiled ITK-5.4, and I enabled the Module_RTK. The installation went smoothly, but I encountered some issues when running the First Reconstruction.cxx

In my code, I only added two string variables to replace command-line inputs, enabling the code to run in VS2022.

The code encounters an error at this line:

   // Writer
   std::cout << "Writing output image..." << std::endl;
   using WriterType = itk::ImageFileWriter<ImageType>;
   WriterType::Pointer writer = WriterType::New();
   writer->SetFileName(img_output);
   writer->SetInput(fieldofview->GetOutput());
   writer->Update(); # error raise in this sentence

and the error message is here (it was translated from chinese):

An unhandled exception occurred at 0x00007FF9A507B699 (located in fdk_test.exe): Microsoft C++ exception: itk::ImageFileWriterException, at memory location 0x000000BA18F5EB28.

my environment:

Any help would be appreciate! sean

SS99aaNN commented 3 months ago

Okay, it seems that my configuration is not entirely complete. In addition to configuring the include, lib, and additional dependencies, I need to add a preprocessor to get RTK running correctly.

SimonRit commented 3 months ago

Okay, it seems that my configuration is not entirely complete. In addition to configuring the include, lib, and additional dependencies, I need to add a preprocessor to get RTK running correctly.

Glad you found a solution, thanks for letting us know. What was the required preprocessor?

SS99aaNN commented 2 months ago

In order to use RTK in my VS2022 project, I need to add ITK_IMAGEIO_FACTORY_REGISTER_MANAGER and ITK_FFTIMAGEFILTERINIT_FACTORY_REGISTER_MANAGER to the preprocessor definitions so that the project can compile correctly.