<html><body><div style="color:#000; background-color:#fff; font-family:tahoma, new york, times, serif;font-size:10pt"><div style="font-family: tahoma, 'new york', times, serif; font-size: 10pt;">Hello,</div><div style="font-family: tahoma, 'new york', times, serif; font-size: 10pt;"><br></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">I want to do some casting without success.</div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">For the purpose of generating an integral image and the bounded range in e.g. char I want to cast the image prior to caculating the integrals.</div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">Whenever I cast to long which
 is sufficient for 2D images it works all fine and also for small 3D test images when casting to long I get all the values I want to.</div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="font-family: tahoma, 'new york', times, serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">Bu when I try casting to datatype long long using the CastImageFilter the output of the cast is an empty image, i.e. and image with index={0,0,0}, spacing={0,0,0}, size={0,0,0} and so on. So only standard values.</div><div style="background-color: transparent;"><font face="tahoma, new york, times, serif" size="2">I had a look into the CastImageFilter-code and there is also a concept check&nbsp;</font><span style="background-color: transparent;"><font face="tahoma, new york, times, serif"
 size="2">Concept::Convertible&lt; typename TInputImage::PixelType,</font></span><span style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent;">&nbsp; typename TOutputImage::PixelType &gt;</span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><span style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent;">So why does this happen?</span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><span style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent;"><br></span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style:
 normal;"><span style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent;">Short snippet of my code:</span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><span style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; typedef itk::Image&lt;long long, 3&gt; ImageType;</span></div><div style="background-color: transparent;"><span style="background-color: transparent;"><font face="tahoma, new york, times, serif" size="2"><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space: pre;">                                </span>typedef itk::Image&lt;unsigned short, Dimensions&gt; InputImageType;</div><div style="background-color: transparent;"><span
 class="Apple-tab-span" style="white-space:pre">                                </span>typedef itk::CastImageFilter&lt;InputImageType, ImageType&gt; CastType;</div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><br></div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                </span>typename CastType::Pointer caster = CastType::New();</div><div style="background-color: transparent;"><br></div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                </span>typename InputImageType::Pointer image = imageW-&gt;get&lt;InputImageType&gt;(); //imageW is a wrapper that allows handling of an image without knowing its type</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                </span>caster-&gt;SetInput(image);</div><div style="background-color:
 transparent;"><span class="Apple-tab-span" style="white-space: pre;">                                </span>typename&nbsp;ImageType::Pointer integral&nbsp;= caster-&gt;GetOutput();</div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><br></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;">After execution of the previous code integral keeps and empty image. Not a itkSmartPointer that points to Null but a real image of my type without content as described above.</div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><br></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;">I hope you
 can help me.</div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;"><br></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;">Thanks in advance,</div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; font-style: normal;">Willi</div></font></span></div></div></body></html>