<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:PMingLiU;
        panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Cambria;
        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;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 5 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","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;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></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=ZH-TW link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-family:"Cambria","serif"'>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Cambria","serif"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Cambria","serif"'>It works! Thank you very much.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Cambria","serif"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Cambria","serif"'>Now there&#8217;s another problem. If I want to combine them back to a vector after doing some processing on each component, it seems a good idea to use itkImageToVectorImageFilter.h. However, the original vector image is of </span><i><span lang=EN-US style='font-family:"Cambria","serif"'>itk::Image&lt; itk::Vector&lt;float, 6&gt;, 3 &gt;</span></i><span lang=EN-US style='font-family:"Cambria","serif"'> type, while the output image of the filter is of itk::VectorImage type. They are essentially different in their way of storing components. Is there a way to make them consistent? Say, casting VectorImage to Image&lt;Vector&lt;float, 6&gt;, 3&gt; or another filter that works the same but gives Image&lt;Vector&lt;float, 6&gt;, 3&gt; as output.</span><span lang=EN-US style='font-family:"Cambria","serif"'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif";color:#1F497D'>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif";color:#1F497D'>Meng-Kang Hsieh (Michael)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif";color:#1F497D'>OpSciTech, Erasmus Mundus<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif";color:#1F497D'>Delft University of Technology<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> wanlin [mailto:wanlinzhu@gmail.com] <br><b>Sent:</b> Saturday, March 26, 2011 2:44 AM<br><b>To:</b> Hsieh<br><b>Cc:</b> Luis Ibanez; insight-users@itk.org<br><b>Subject:</b> Re: [Insight-users] Problem in reading nifti image<o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US>HI, Michael<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If your output image is the last selectorIndex component of input vectorimage, you might need disconnect the output image before proceed on. See embedded lines.<o:p></o:p></span></p><div><p class=MsoNormal><span lang=EN-US>On Sat, Mar 26, 2011 at 1:50 AM, Hsieh &lt;<a href="mailto:M.Hsieh@student.tudelft.nl">M.Hsieh@student.tudelft.nl</a>&gt; wrote:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Hi Luis,<br><br>This is a very helpful message that this filter does exactly what I need.<br><br>But, I am wondering if I can use only one instance of the filter to generate multiple output by setting different index? I've tried something as below,<br>&nbsp;int selectorIndex = 0;<br>&nbsp;selector-&gt;SetIndex( selectorIndex );<o:p></o:p></span></p><div><p class=MsoNormal><span lang=EN-US>&nbsp;selector-&gt;Update();<br>ScalarImagePointer output0 = selector-&gt;GetOutput();<br>output0-&gt;DisconnectPipeline();<o:p></o:p></span></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><p class=MsoNormal><span lang=EN-US>&nbsp;writer0-&gt;SetInput( output0);<br>&nbsp;selectorIndex++;<br><br>&nbsp;selector-&gt;SetIndex( selectorIndex );<o:p></o:p></span></p></blockquote><div><p class=MsoNormal><span lang=EN-US>&nbsp; selector-&gt;Update();<br>ScalarImagePointer output1 = selector-&gt;GetOutput();<br>output1-&gt;DisconnectPipeline();<o:p></o:p></span></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><p class=MsoNormal><span lang=EN-US>&nbsp;writer1-&gt;SetInput( output1);<br>&nbsp;selectorIndex++;<br><br>and so on. But all the writers give the same component of the tensor image. Instead, I have to instantiate 6 selectors as many as the writers to achieve the goal of saving six components of a DTI tensor image.<br>However, I'd like to have a single class and one instance that can produce multiple outputs, say, extract all six components in the tensor like:<br>&nbsp; &nbsp; &nbsp; &nbsp;selector-&gt;GetComponentOne( );<br>&nbsp; &nbsp; &nbsp; &nbsp;selector-&gt;GetComponentTwo( );<br>and so on.<br>Do you think that I have to write a new class capable of multiple outputs inherited from the itkVectorIndexSelectionCastImageFilter? Or any simpler way?<o:p></o:p></span></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US><br><br><br>Best regards,<br>Meng-Kang Hsieh (Michael)<br><br><o:p></o:p></span></p></div><div><div><p class=MsoNormal><span lang=EN-US>-----Original Message-----<br>From: Luis Ibanez [mailto:<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>]<br>Sent: Tuesday, February 22, 2011 12:54 AM<br>To: robert tamburo<br>Cc: Hsieh; <a href="mailto:insight-users@itk.org">insight-users@itk.org</a>; <a href="mailto:norman-k-williams@uiowa.edu">norman-k-williams@uiowa.edu</a><br>Subject: Re: [Insight-users] Problem in reading nifti image<br><br>Hi Michael<br><br>As Robert described, the ImageAdaptor will not work before a Writer.<br><br>You may want to use instead the filter:<br><br><a href="http://public.kitware.com/Insight/Doxygen/html/classitk_1_1VectorIndexSelectionCastImageFilter.html" target="_blank">http://public.kitware.com/Insight/Doxygen/html/classitk_1_1VectorIndexSelectionCastImageFilter.html</a><br><br><br>&nbsp; &nbsp; Luis<br><br><br>---------------------------------<br>On Mon, Feb 21, 2011 at 2:06 PM, robert tamburo<br>&lt;<a href="mailto:robert.tamburo@gmail.com">robert.tamburo@gmail.com</a>&gt; wrote:<br>&gt; Section 12.5 of the ITK software guide:<br>&gt; 12.5 Adaptors and Writers<br>&gt; Image adaptors will not behave correctly when connected directly to a<br>&gt; writer. The reason is<br>&gt; that writers tend to get direct access to the image buffer from their input,<br>&gt; since image adaptors<br>&gt; do not have a real buffer their behavior in this circumstances is incorrect.<br>&gt; You should avoid<br>&gt; instantiating the ImageFileWriter or the ImageSeriesWriter over an image<br>&gt; adaptor type.<br>&gt; From an email to the user list by Luis'<br>&gt; (<a href="http://www.itk.org/pipermail/insight-users/2005-April/012553.html" target="_blank">http://www.itk.org/pipermail/insight-users/2005-April/012553.html</a>):<br>&gt; This means that when you use ImageAdaptors, you must make sure<br>&gt; that the filter receiving the Adaptor is based on the use of the<br>&gt; &quot;*WithIndex&quot; iterators.<br>&gt;<br>&gt; On Mon, Feb 21, 2011 at 1:36 PM, Hsieh &lt;<a href="mailto:M.Hsieh@student.tudelft.nl">M.Hsieh@student.tudelft.nl</a>&gt; wrote:<br>&gt;&gt;<br>&gt;&gt; Hi,<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; Now I send it to Insight-Users mailing list.<br>&gt;&gt;<br>&gt;&gt; My purpose is to extract elements from the tensor image to analyze and<br>&gt;&gt; register the tensor channels. With your help now I can do so with vector<br>&gt;&gt; image adaptor, which extracts one of the element of the vector. However, in<br>&gt;&gt; the example of ImageAdaptor3.cxx, the adaptor itself cannot directly be fed<br>&gt;&gt; into the writer to create a scalar image. It is shown that a filter, such as<br>&gt;&gt; rescaling the intensity, has to be done and therefore the<br>&gt;&gt; rescaler-&gt;GetOutput() can be set as the input image for writer. Is there a<br>&gt;&gt; way not to modify the intensity of the image? Is there an identity filter or<br>&gt;&gt; something like that?<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; Best regards,<br>&gt;&gt;<br>&gt;&gt; Michael<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; This is more of a question for the Insight-Users mailing list.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; That being said, you don't show your work, so I can't say exactly what<br>&gt;&gt; you're doing wrong.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; I wrote the NIfTI image reader, and as I remember there's some strange<br>&gt;&gt; things that go on with respect to &nbsp;Images with dimension &gt; 3.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; If I recall correctly, in a NIfTI image dimensions of [ 128 128 64 1 6 ]<br>&gt;&gt; would not correspond to an 5D scalar image at all. &nbsp;It would be a 3D image<br>&gt;&gt; where each voxel is a 6-element vector. &nbsp;The 4th dimension is ALWAYS<br>&gt;&gt; interpreted as a time dimension, and the sixth and subsequent dimensions are<br>&gt;&gt; interpreted according to what the image modality actually was. &nbsp;Most often,<br>&gt;&gt; and what's implemented in the reader, is to interpret it as an Image of<br>&gt;&gt; Vector voxels. So NiftiImageIO reads in 6 3D volumes, and then constructs<br>&gt;&gt; vector pixels by pulling one pixel from each of the volumes.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; In other words if you used<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; typedef itk::Image&lt; itk::Vector&lt;float, 6&gt;, 3 &gt; ImageType;<br>&gt;&gt;<br>&gt;&gt; typedef itk::ImageFileReader&lt;Imagetype&gt; ImageReaderType;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; You would get all the data. &nbsp;If you use<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; typedef itk::Image&lt;float, 3&gt; ImageType;<br>&gt;&gt;<br>&gt;&gt; typedef itk::ImageFileReader&lt;ImageType&gt; ImageReaderType;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; the ImageFileReader will think that it's a vector image and try to convert<br>&gt;&gt; the vector voxels to a scalar voxel, probably by taking the first value of<br>&gt;&gt; each voxel's vector. &nbsp;It will then report the image size as you reported.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; From: Hsieh &lt;<a href="mailto:M.Hsieh@student.tudelft.nl">M.Hsieh@student.tudelft.nl</a>&gt;<br>&gt;&gt; Date: Fri, 18 Feb 2011 16:35:07 +0100<br>&gt;&gt; To: ITK &lt;<a href="mailto:insight-developers@itk.org">insight-developers@itk.org</a>&gt;<br>&gt;&gt; Subject: [Insight-developers] Problem in reading 5D nifti image<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; Hi,<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; I am trying to read a diffusion tensor image in nifti(.nii) format, which<br>&gt;&gt; has dimension of [128 128 64 1 6]. However, the image I got after read by<br>&gt;&gt; the itkImageFileReader.h had dimension only [128 128 64 1 1]. The last two<br>&gt;&gt; dimension are suppressed by the reader. When I looked into the class (.h)<br>&gt;&gt; and the .txx file, I found out that the numberOfDimensionsIO, which is 3, is<br>&gt;&gt; smaller than TOutputImage::ImageDimension, which is set manually to 5, so<br>&gt;&gt; that the 4th and the 5th dimension are set to 1 later. Why does that happen?<br>&gt;&gt; numberOfDimensionsIO should be 5 in this case.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; Best regards,<br>&gt;&gt;<br>&gt;&gt; Meng-Kang Hsieh (Michael)<br>&gt;&gt;<br>&gt;&gt; OpSciTech, Erasmus Mundus<br>&gt;&gt;<br>&gt;&gt; Delft University of Technology<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; Best regards,<br>&gt;&gt;<br>&gt;&gt; Meng-Kang Hsieh (Michael)<br>&gt;&gt;<br>&gt;&gt; OpSciTech, Erasmus Mundus<br>&gt;&gt;<br>&gt;&gt; Delft University of Technology<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; _____________________________________<br>&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>&gt;&gt;<br>&gt;&gt; Visit other Kitware open-source projects at<br>&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>&gt;&gt;<br>&gt;&gt; Kitware offers ITK Training Courses, for more information visit:<br>&gt;&gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>&gt;&gt;<br>&gt;&gt; Please keep messages on-topic and check the ITK FAQ at:<br>&gt;&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>&gt;&gt;<br>&gt;&gt; Follow this link to subscribe/unsubscribe:<br>&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>&gt;&gt;<br>&gt;<br>&gt;<br>&gt; _____________________________________<br>&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>&gt;<br>&gt; Visit other Kitware open-source projects at<br>&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>&gt;<br>&gt; Kitware offers ITK Training Courses, for more information visit:<br>&gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>&gt;<br>&gt; Please keep messages on-topic and check the ITK FAQ at:<br>&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>&gt;<br>&gt; Follow this link to subscribe/unsubscribe:<br>&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>&gt;<br>&gt;<br>_____________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br><a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><o:p></o:p></span></p></div></div></blockquote></div><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p></div></body></html>