ok I am now trying to follow the example from the ItkSoftwareGuide.pdf page 330. I have made a new project using ITK 3.12.0 (just copied the HelloWorld example) and in the source file I have:<br><br>#include "itkImage.h"<br>
#include <iostream><br>#include "itkGDCMImageIO.h"<br>#include "itkGDCMSeriesFileNames.h"<br>#include "itkImageSeriesReader.h"<br>#include "itkImageFileWriter.h"<br><br>int main( int argc, char* argv[] )<br>
{<br><br> if( argc < 3 ){<br> std::cerr << "Usage: " << std::endl;<br> std::cerr << argv[0] << " DicomDirectory outputFileName [seriesName]" <br> << std::endl;<br>
return EXIT_FAILURE;<br> }<br><br> const unsigned int Dimension = 3; <br> typedef signed short PixelType;<br> typedef itk::Image< PixelType, Dimension > ImageType;<br>
typedef itk::ImageSeriesReader< ImageType > ReaderType;<br><br> ReaderType::Pointer bob = ReaderType::New(); // This line gives a linker error.<br>...<br>...<br><br><br>But the last line:<br><br><br>
ReaderType::Pointer bob = ReaderType::New();<br><br><br>gives the following linker errors when compiling using Visual Studio 2008 on Vista 64:<br><br>>HelloWorld.obj : error LNK2019: unresolved external symbol "public: static class itk::SmartPointer<class itk::ImageIOBase> __cdecl itk::ImageIOFactory::CreateImageIO(char const *,enum itk::ImageIOFactory::FileModeType)" (?CreateImageIO@ImageIOFactory@itk@@SA?AV?$SmartPointer@VImageIOBase@itk@@@2@PBDW4FileModeType@12@@Z) referenced in function __catch$?GenerateOutputInformation@?$ImageFileReader@V?$Image@F$02@itk@@V?$DefaultConvertPixelTraits@F@2@@itk@@UAEXXZ$0<br>
1>HelloWorld.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall itk::ImageIORegion::~ImageIORegion(void)" (??1ImageIORegion@itk@@UAE@XZ) referenced in function "public: virtual void __thiscall itk::ImageFileReader<class itk::Image<short,3>,class itk::DefaultConvertPixelTraits<short> >::EnlargeOutputRequestedRegion(class itk::DataObject *)" (?EnlargeOutputRequestedRegion@?$ImageFileReader@V?$Image@F$02@itk@@V?$DefaultConvertPixelTraits@F@2@@itk@@UAEXPAVDataObject@2@@Z)<br>
1>HelloWorld.obj : error LNK2019: unresolved external symbol "public: __thiscall itk::ImageIORegion::ImageIORegion(unsigned int)" (??0ImageIORegion@itk@@QAE@I@Z) referenced in function "public: virtual void __thiscall itk::ImageFileReader<class itk::Image<short,3>,class itk::DefaultConvertPixelTraits<short> >::EnlargeOutputRequestedRegion(class itk::DataObject *)" (?EnlargeOutputRequestedRegion@?$ImageFileReader@V?$Image@F$02@itk@@V?$DefaultConvertPixelTraits@F@2@@itk@@UAEXPAVDataObject@2@@Z)<br>
1>HelloWorld.obj : error LNK2019: unresolved external symbol "public: long __thiscall itk::ImageIOBase::GetImageSizeInBytes(void)const " (?GetImageSizeInBytes@ImageIOBase@itk@@QBEJXZ) referenced in function __catch$?GenerateData@?$ImageFileReader@V?$Image@F$02@itk@@V?$DefaultConvertPixelTraits@F@2@@itk@@MAEXXZ$0<br>
1>HelloWorld.obj : error LNK2019: unresolved external symbol "public: __thiscall itk::ImageIORegion::ImageIORegion(class itk::ImageIORegion const &)" (??0ImageIORegion@itk@@QAE@ABV01@@Z) referenced in function __catch$?GenerateData@?$ImageFileReader@V?$Image@F$02@itk@@V?$DefaultConvertPixelTraits@F@2@@itk@@MAEXXZ$0<br>
1>HelloWorld.obj : error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl itk::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class itk::ImageIORegion const &)" (??6itk@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@ABVImageIORegion@0@@Z) referenced in function __catch$?GenerateData@?$ImageFileReader@V?$Image@F$02@itk@@V?$DefaultConvertPixelTraits@F@2@@itk@@MAEXXZ$0<br>
1>HelloWorld.obj : error LNK2019: unresolved external symbol "public: void __thiscall itk::ImageIORegion::SetIndex(unsigned long,long)" (?SetIndex@ImageIORegion@itk@@QAEXKJ@Z) referenced in function "public: static void __cdecl itk::ImageIORegionAdaptor<3>::Convert(class itk::ImageRegion<3> const &,class itk::ImageIORegion &,class itk::Index<3> const &)" (?Convert@?$ImageIORegionAdaptor@$02@itk@@SAXABV?$ImageRegion@$02@2@AAVImageIORegion@2@ABV?$Index@$02@2@@Z)<br>
1>HelloWorld.obj : error LNK2019: unresolved external symbol "public: void __thiscall itk::ImageIORegion::SetSize(unsigned long,unsigned long)" (?SetSize@ImageIORegion@itk@@QAEXKK@Z) referenced in function "public: static void __cdecl itk::ImageIORegionAdaptor<3>::Convert(class itk::ImageRegion<3> const &,class itk::ImageIORegion &,class itk::Index<3> const &)" (?Convert@?$ImageIORegionAdaptor@$02@itk@@SAXABV?$ImageRegion@$02@2@AAVImageIORegion@2@ABV?$Index@$02@2@@Z)<br>
1>HelloWorld.obj : error LNK2019: unresolved external symbol "public: unsigned int __thiscall itk::ImageIORegion::GetImageDimension(void)const " (?GetImageDimension@ImageIORegion@itk@@QBEIXZ) referenced in function "public: static void __cdecl itk::ImageIORegionAdaptor<3>::Convert(class itk::ImageRegion<3> const &,class itk::ImageIORegion &,class itk::Index<3> const &)" (?Convert@?$ImageIORegionAdaptor@$02@itk@@SAXABV?$ImageRegion@$02@2@AAVImageIORegion@2@ABV?$Index@$02@2@@Z)<br>
1>HelloWorld.obj : error LNK2019: unresolved external symbol "public: long __thiscall itk::ImageIORegion::GetIndex(unsigned long)const " (?GetIndex@ImageIORegion@itk@@QBEJK@Z) referenced in function "public: static void __cdecl itk::ImageIORegionAdaptor<3>::Convert(class itk::ImageIORegion const &,class itk::ImageRegion<3> &,class itk::Index<3> const &)" (?Convert@?$ImageIORegionAdaptor@$02@itk@@SAXABVImageIORegion@2@AAV?$ImageRegion@$02@2@ABV?$Index@$02@2@@Z)<br>
1>HelloWorld.obj : error LNK2019: unresolved external symbol "public: unsigned long __thiscall itk::ImageIORegion::GetSize(unsigned long)const " (?GetSize@ImageIORegion@itk@@QBEKK@Z) referenced in function "public: static void __cdecl itk::ImageIORegionAdaptor<3>::Convert(class itk::ImageIORegion const &,class itk::ImageRegion<3> &,class itk::Index<3> const &)" (?Convert@?$ImageIORegionAdaptor@$02@itk@@SAXABVImageIORegion@2@AAV?$ImageRegion@$02@2@ABV?$Index@$02@2@@Z)<br>
1>HelloWorld.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall itk::ImageIOBase::GetComponentTypeAsString(enum itk::ImageIOBase::IOComponentType)const " (?GetComponentTypeAsString@ImageIOBase@itk@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4IOComponentType@12@@Z) referenced in function "protected: void __thiscall itk::ImageFileReader<class itk::Image<short,3>,class itk::DefaultConvertPixelTraits<short> >::DoConvertBuffer(void *,unsigned long)" (?DoConvertBuffer@?$ImageFileReader@V?$Image@F$02@itk@@V?$DefaultConvertPixelTraits@F@2@@itk@@IAEXPAXK@Z)<br>
<br><br><br>This is the content of the CMakeLists.txt file:<br><br># This is the root ITK CMakeLists file.<br>CMAKE_MINIMUM_REQUIRED(VERSION 2.4)<br>IF(COMMAND CMAKE_POLICY)<br> CMAKE_POLICY(SET CMP0003 NEW)<br>ENDIF(COMMAND CMAKE_POLICY)<br>
<br><br># This project is designed to be built outside the Insight source tree.<br>PROJECT(HelloWorld)<br><br># Find ITK.<br>FIND_PACKAGE(ITK REQUIRED)<br>INCLUDE(${ITK_USE_FILE})<br><br>ADD_EXECUTABLE(HelloWorld HelloWorld.cxx )<br>
<br>TARGET_LINK_LIBRARIES(HelloWorld ITKCommon)<br><br><br>Do I need to add some LINK_DIRECTORIES ?<br><br><br><div class="gmail_quote">On Wed, Jun 10, 2009 at 11:26 AM, Mathieu Malaterre <span dir="ltr"><<a href="mailto:mathieu.malaterre@gmail.com">mathieu.malaterre@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">On Tue, Jun 9, 2009 at 10:56 PM, motes motes<<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>> wrote:<br>
> I have a .dcm file containing multiple frames. I need to downsample each<br>
> frame and store them in a new and smaller .dcm file. Currently I use matlab<br>
> for the first part:<br>
><br>
> for i=1: frameNum<br>
> img0 = dicomread(filename, 'frames', i)<br>
> img1 = downsample(img0);<br>
> %dicomwrite(img1, 'test.dcm')<br>
> % store img1....<br>
> end<br>
><br>
> But it seems that its only possible to store each frame as a separate file -<br>
> and not as a single multiframe .dcm file.<br>
><br>
> I was therefore wondering if ITK had any functionality to make this<br>
> possible? I found this post:<br>
><br>
> <a href="http://www.itk.org/pipermail/insight-users/2003-September/004762.html" target="_blank">http://www.itk.org/pipermail/insight-users/2003-September/004762.html</a><br>
><br>
> and the file itkDICOMImageSeriesTest.cxx in:<br>
><br>
> InsightToolkit-3.12.0\Testing\Code\IO<br>
><br>
> But maybe there are some more documentation on how to do this?<br>
><br>
<br>
</div></div>Yes.<br>
7.12.3 Reading a 2D DICOM Series and Writing a Volume (from<br>
ItkSoftwareGuide.pdf).<br>
<br>
Please do not cross post to dicom newsgroup for a matlab function, thanks.<br>
<br>
2cts.<br>
--<br>
<font color="#888888">Mathieu<br>
</font></blockquote></div><br>