<div dir="ltr">Dear All, <div><br></div><div>I tried the following code but it always give error that </div><div><br></div><div><span class="Apple-style-span" style="font-family: 'courier new', monospace; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">US1d3ITKImgType , </span><span class="Apple-style-span" style="font-family: 'courier new', monospace; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">S1d3ITKImgType ,.. not defined am I missing something </span></div>
<div><span class="Apple-style-span" style="font-family: 'courier new', monospace; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><br></span></div>
<div><span class="Apple-style-span" style="font-family: 'courier new', monospace; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">sorry for this naive question </span></div>
<div><span class="Apple-style-span" style="font-family: 'courier new', monospace; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><br></span></div>
<div><span class="Apple-style-span" style="font-family: 'courier new', monospace; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">Best regards </span></div>
<div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><span class="Apple-style-span" style="font-family: verdana, geneva, helvetica, arial, sans-serif; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); ">
<font face="'courier new', monospace"><span>typedef itk::ImageIOBase::IOComponentType <b class="highlight" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 102); background-position: initial initial; background-repeat: initial initial; ">ScalarPixelType</b>;</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"><br>
</font></div><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"><span> itk::ImageIOBase::Pointer imageIO =</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                </span></font></span><font face="'courier new', monospace"><span>itk::ImageIOFactory::CreateImageIO(</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                        </span></font></span><font face="'courier new', monospace"><span>params::filenameIn, itk::ImageIOFactory::ReadMode);</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"><br>
</font></div><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>        </span></font></span><font face="'courier new', monospace"><span>if (!imageIO) {</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                </span></font></span><font face="'courier new', monospace"><span>std::cerr << "Unable to create a valid ImageIO for image " <<</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                        </span></font></span><font face="'courier new', monospace"><span>params::filenameIn << ". Exiting." << std::endl;</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                </span></font></span><font face="'courier new', monospace"><span>return -1;</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>        </span></font></span><font face="'courier new', monospace"><span>}</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"><br>
</font></div><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"><span>// Now that we found the appropriate ImageIO class, ask it to</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"><span>// read the meta data from the image file.</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"><span>//</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"><span> imageIO->SetFileName(params::filenameIn);</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"><span> imageIO->ReadImageInformation();</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>        </span></font></span><font face="'courier new', monospace"><span>const <b class="highlight" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 102); background-position: initial initial; background-repeat: initial initial; ">ScalarPixelType</b> pixelType = imageIO->GetComponentType();</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>        </span></font></span><font face="'courier new', monospace"><span>if (params::verbose)</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                </span></font></span><font face="'courier new', monospace"><span>std::cout << "Pixel Type is " << imageIO->GetComponentTypeAsString(pixelType)</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                        </span></font></span><font face="'courier new', monospace"><span><< std::endl;</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>        </span></font></span><font face="'courier new', monospace"><span>const size_t numDimensions = imageIO->GetNumberOfDimensions();</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>        </span></font></span><font face="'courier new', monospace"><span>if (numDimensions != 3) {</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                </span></font></span><font face="'courier new', monospace"><span>std::cerr << "This soft only soports 3D volumes. Exiting"</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                        </span></font></span><font face="'courier new', monospace"><span><< std::endl;</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                </span></font></span><font face="'courier new', monospace"><span>return -1;</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>        </span></font></span><font face="'courier new', monospace"><span>}</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"><br>
</font></div><span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"><span> switch (pixelType) {</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                </span></font></span><font face="'courier new', monospace"><span>case itk::ImageIOBase::UCHAR: DoTheRealThing<UC1d3ITKImgType>(); break; //</span></font><span style="font-family: 'courier new', monospace; "><span>UC1d3ITKImgType = unsigned char image of 1 channel, 3 dimensions</span></span></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                </span></font></span><font face="'courier new', monospace"><span>case itk::ImageIOBase::SHORT: DoTheRealThing<S1d3ITKImgType>(); break; //S1d3 = Short, one chanel, 3dimensions</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                </span></font></span><font face="'courier new', monospace"><span>case itk::ImageIOBase::USHORT: DoTheRealThing<US1d3ITKImgType>(); break;</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                </span></font></span><font face="'courier new', monospace"><span>case itk::ImageIOBase::FLOAT: DoTheRealThing<F1d3ITKImgType>(); break;</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                </span></font></span><font face="'courier new', monospace"><span>default:</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                        </span></font></span><font face="'courier new', monospace"><span>std::cerr << "Pixel Type ("</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                                </span></font></span><font face="'courier new', monospace"><span><< imageIO->GetComponentTypeAsString(pixelType)</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                                </span></font></span><font face="'courier new', monospace"><span><< ") not supported. Exiting." << std::endl;</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><span style="white-space: pre-wrap; "><font face="'courier new', monospace"><span>                        </span></font></span><font face="'courier new', monospace"><span>return -1;</span></font></div>
<div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"><span> }</span></font></div>
<span></span><div style="border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); "><font face="'courier new', monospace"></font><font face="'courier new', monospace"><span>return 0;</span></font></div>
</span></div></div>