<html><body><div style="color:#000; background-color:#fff; font-family:tahoma, new york, times, serif;font-size:10pt"><div>Sorry,</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal;">I solved the problem.</div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal;">It wasn't due to the datatype. I forgot calling caster->Update().</div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal;">In the examples this method is never called. Why is this?</div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size:
13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal;">Cheers,</div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal;">Willi</div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <div style="font-family: tahoma, 'new york', times, serif; font-size: 10pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1"> <font size="2" face="Arial"> <b><span style="font-weight:bold;">Von:</span></b> Willi Huber <surfersparadise85-itk@yahoo.com><br> <b><span style="font-weight: bold;">An:</span></b> "insight-users@itk.org" <insight-users@itk.org> <br> <b><span style="font-weight: bold;">Gesendet:</span></b> 15:49 Samstag, 20.April 2013<br> <b><span style="font-weight:
bold;">Betreff:</span></b> [Insight-users] CastImageFilter: Error when casting to long long<br> </font> </div> <div class="y_msg_container"><br><div id="yiv245535616"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); 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 </font><span style="background-color:transparent;"><font face="tahoma, new york, times, serif"
size="2">Concept::Convertible< typename TInputImage::PixelType,</font></span><span style="font-family: tahoma, 'new york', times, serif; font-size: 13px; background-color: transparent;"> typename TOutputImage::PixelType ></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;"> typedef itk::Image<long long, 3> 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="yiv245535616Apple-tab-span" style="white-space:pre;">                                </span>typedef itk::Image<unsigned short, Dimensions> InputImageType;</div><div
style="background-color:transparent;"><span class="yiv245535616Apple-tab-span" style="white-space:pre;">                                </span>typedef itk::CastImageFilter<InputImageType, ImageType> 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="yiv245535616Apple-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="yiv245535616Apple-tab-span" style="white-space:pre;">                                </span>typename InputImageType::Pointer image = imageW->get<InputImageType>(); //imageW is a wrapper that allows handling of an image without knowing its type</div><div style="background-color:transparent;"><span class="yiv245535616Apple-tab-span"
style="white-space:pre;">                                </span>caster->SetInput(image);</div><div style="
background-color:transparent;"><span class="yiv245535616Apple-tab-span" style="white-space:pre;">                                </span>typename ImageType::Pointer integral = caster->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></div></div><br>_____________________________________<br>Powered by www.kitware.com<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.php"
target="_blank">http://www.kitware.com/products/protraining.php</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><br><br><br></div> </div> </div> </blockquote></div> </div></body></html>