<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=NL link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span lang=EN-GB>Hi all,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>I am fairly new to ITK and have a couple of
questions:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>1. When creating a new ITK program, do I
always have to go through CMake to create (in my case) a .sln Visual Studio
Solution? Or do I otherwise have to specify all the additional directories +
libraries for the linker manually?<o:p></o:p></span></p>
<p class=MsoListParagraph><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-GB>2. I tried
adapting the ImageReadWrite.cxx slightly in order to read the BrainMidSagittalSlice.png
found in the ITK/Examples/Data directory. <br>
My source code is:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:blue'>#include</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:maroon'>"itkImageFileReader.h"<o:p></o:p></span></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:blue'>#include</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:maroon'>"itkImageFileWriter.h"<o:p></o:p></span></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:maroon'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:blue'>#include</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:maroon'>"itkImage.h"<o:p></o:p></span></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:maroon'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:maroon'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:blue'>int</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> main()<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>{<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> <span style='color:blue'>short</span>
PixelType;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>const</span> <span style='color:blue'>unsigned</span>
<span style='color:blue'>int</span>
Dimension = 2;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> itk::Image< PixelType, Dimension
> ImageType;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> itk::ImageFileReader< ImageType >
ReaderType;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> itk::ImageFileWriter< ImageType >
WriterType;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
ReaderType::Pointer reader = ReaderType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> WriterType::Pointer
writer = WriterType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>const</span> <span style='color:blue'>char</span> *
inputFilename = <span style='color:maroon'>"BrainMidSagittalSlice.png"</span>;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>const</span> <span style='color:blue'>char</span> *
outputFilename = <span style='color:maroon'>"BrainMidSagittalSlice_output.png"</span>;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
reader->SetFileName( inputFilename );<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
writer->SetFileName( outputFilename );<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
writer->SetInput( reader->GetOutput() );<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>try</span> <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
{ <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
writer->Update(); <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
} <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>catch</span>( itk::ExceptionObject & err ) <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
{ <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
std::cerr << <span style='color:maroon'>"ExceptionObject caught
!"</span> << std::endl; <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
std::cerr << err << std::endl;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
<span style='color:blue'>return</span> EXIT_FAILURE;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
} <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>return</span> EXIT_SUCCESS;<o:p></o:p></span></p>
<p class=MsoListParagraph style='margin-left:72.0pt'><span style='font-size:
10.0pt;font-family:"Courier New"'>}</span><span lang=EN-GB><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>With CmakeList.txt:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB>
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>CMAKE_MINIMUM_REQUIRED(VERSION
2.4)<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>IF(COMMAND
CMAKE_POLICY)<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
CMAKE_POLICY(SET CMP0003 NEW)<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>ENDIF(COMMAND
CMAKE_POLICY)<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'># This project is
designed to be built outside the Insight source tree.<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>PROJECT(ImageReadWrite)<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'># Find ITK.<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>FIND_PACKAGE(ITK
REQUIRED)<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>INCLUDE(${ITK_USE_FILE})<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>ADD_EXECUTABLE(ImageReadWrite
ImageReadWrite.cxx)<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-autospace:none'><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>TARGET_LINK_LIBRARIES(ImageReadWrite
ITKIO)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>When running the resulting executable from
a cmd prompt as ‘ImageReadWrite’, I get the following error:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>C:\ITK-dev\ImageReadWrite\debug>ImageReadWrite<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>ExceptionObject
caught !<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>itk::ImageFileReaderException
(0133F0CC)<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>Location:
"void __thiscall itk::ImageFileReader<class
itk::Image<short,2>,class<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>itk::DefaultConvertPixelTraits<short>
>::GenerateOutputInformation(void)"<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>File:
c:\itk-src\insighttoolkit-3.20.0\insighttoolkit-3.20.0\code\io\itkImageFileReader.txx<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>Line: 146<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>Description:
Could not create IO object for file BrainMidSagittalSlice.png<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US> Tried to
create one of the following:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
BioRadImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
GDCMImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
MetaImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
PNGImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
VTKImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
GiplImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
LSMImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
AnalyzeImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
NiftiImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
StimulateImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
JPEGImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
TIFFImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
NrrdImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
BMPImageIO<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
DICOMImageIO2<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US> You
probably failed to set a file suffix, or set the suffix to an unsupported
type.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>As I understood from previous mails on this
list, the IO object decides automatically to what format it should write. What am
I doing wrong?<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>3. I’d like to read a 3D+time dataset in
ITK. The original dataset is in dicom format but I have previously extracted
the relevant data and converted to a .mat format for further processing in
Matlab (in practice this is just one big 4D matrix). Furthermore, we have
developed a visualisation tool to manually segment such a dataset and export a
mesh (cloud of points with connectivity matrix) containing this manual
contouring.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>I was wondering what format I could use to
import such a series of 3D matrices and import this cloud of points. I doubt
that a dicomreader would work as the image data is stored in a private
datastructure in the dicomformat.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>4. I’d like to register this set of 3D
images and know how my cloud of points are deformed by the registration
algorithm. Is this possible in ITK? Likewise, would it be possible to calculate
how an overlying grid deforms due to this registration? Finally, I would like
to export the positions of this deformed set of points (and preferably the deformed
floating images). Can I do this in a Matlab compatible format or do I have to
write a mex wrapper for this? <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>Many thanks,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>Best regards,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>Brecht <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
</div>
</body>
</html>