[ITK-users] [ITK] itk::CastImageFilter causes AccessViolationException

Bradley Lowekamp brad at lowekamp.net
Thu Jul 28 09:01:57 EDT 2016


Hello,

I noticed you are using type int for you imageSiize. How big is your image? You may be overflowing when computing the number of pixels.

I don’t think you have provided a stack trace of when the error occurs. That would be helpful too.

Brad

> On Jul 28, 2016, at 8:29 AM, Dženan Zukić <dzenanz at gmail.com> wrote:
> 
> Have you tried calling Update on the import filter? That might be the problem. Cast filter is simple and non-special, I doubt it is the problem.
> 
> On Wed, Jul 27, 2016 at 8:26 PM, Andrew Harris <aharr8 at uwo.ca <mailto:aharr8 at uwo.ca>> wrote:
> Thanks Dženan, as I said in my previous email running Update() on the castFilter pointer returns the same error.  I did put in a try/catch block to update it though. 
> 
> --
> 
> AH
> 
> 
> 
> -----------------------------------------------------------------------------------------------
> 
> This email and any attachments thereto may contain private, confidential, and privileged materials for the sole use of the intended recipient. Any reviewing, copying, or distribution of this email (or any attachments thereto) by other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently destroy this email and any attachments thereto.
> 
> 
> On Wed, Jul 27, 2016 at 5:16 PM, Dženan Zukić <dzenanz at gmail.com <mailto:dzenanz at gmail.com>> wrote:
> Hi Andrew,
> 
> I think that line 62 of .cpp should be:
> castFilter->Update();
> I don't see the pipeline updated elsewhere.
> 
> Regards,
> Dženan
> 
> On Wed, Jul 27, 2016 at 3:54 PM, Andrew Harris <aharr8 at uwo.ca <mailto:aharr8 at uwo.ca>> wrote:
> Thanks for getting back to me, after conferring with a colleague I tried using the output of the cast filter directly in the subsequent pipeline rather than writing it to a new image object of the filter's output type. I got the same error doing that, and also got the same error just running Update() on the cast filter, which leads me to believe I'm doing something wrong in setting up the cast filter.  I'm attaching my code for the class I'm writing, hope it's something simple I'm doing wrong. Currently it's throwing the exception at line 85 when the registration transform initializer is activated.
> 
> --
> 
> AH
> 
> 
> 
> -----------------------------------------------------------------------------------------------
> 
> This email and any attachments thereto may contain private, confidential, and privileged materials for the sole use of the intended recipient. Any reviewing, copying, or distribution of this email (or any attachments thereto) by other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently destroy this email and any attachments thereto.
> 
> 
> On Tue, Jul 26, 2016 at 7:09 PM, Bradley Lowekamp <brad at lowekamp.net <mailto:brad at lowekamp.net>> wrote:
> Hello,
> 
> The most common mistake here would be forgetting to call Allocate on your image. Beyond that sharing your code would be helpful. 
> 
> Brad
> 
> On Jul 26, 2016, at 1:43 PM, Andrew Harris <aharr8 at uwo.ca <mailto:aharr8 at uwo.ca>> wrote:
> 
>> Hello,
>> I am attempting to use the CastImageFilter to convert between unsigned char and float image types, and am getting a System.AccessViolationException at runtime.  I have seen reference to this being caused by referring to a pointer that is out of scope, but in this case both the image and the cast filter are delcared in the same method, so I’m not sure how it can be going out of scope.  I can include the header and definition files if that would be helpful.
>> --
>> 
>> AH
>> 
>> 
>> 
>> -----------------------------------------------------------------------------------------------
>> 
>> This email and any attachments thereto may contain private, confidential, and privileged materials for the sole use of the intended recipient. Any reviewing, copying, or distribution of this email (or any attachments thereto) by other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently destroy this email and any attachments thereto.
>> 
>> _____________________________________
>> Powered by www.kitware.com <http://www.kitware.com/>
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
>> 
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.php <http://www.kitware.com/products/protraining.php>
>> 
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ <http://www.itk.org/Wiki/ITK_FAQ>
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/insight-users <http://public.kitware.com/mailman/listinfo/insight-users>
> 
> 
> _____________________________________
> Powered by www.kitware.com <http://www.kitware.com/>
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php <http://www.kitware.com/products/protraining.php>
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ <http://www.itk.org/Wiki/ITK_FAQ>
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users <http://public.kitware.com/mailman/listinfo/insight-users>
> 
> 
> 
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20160728/e822cf82/attachment.html>


More information about the Insight-users mailing list