<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Thanks for reply. I shared the same issue with forum as well under community category. Please find the below code. This is simple cpp file containing function to read dicom. In which the dicomReader pointer is made global. This code runs in release mode and crahes in debug mode. While debugging i found that i crashes in itkImageSource class under template< typename TOutputImage > ImageSource< TOutputImage >::ImageSource().<br><br></div><div>// itk headers<br>#include "itkGDCMImageIO.h"<br>#include "itkGDCMSeriesFileNames.h"<br>#include "itkImageSeriesReader.h"<br>#include "itkImageSeriesWriter.h"<br>#include "itksys/SystemTools.hxx"<br>#include "itkVersion.h"<br>#include "itkImage.h"<br>#include "gdcmUIDGenerator.h"<br>#include "itkFileOutputWindow.h"<br>#include "DicomReader.hpp"</div><div><br data-mce-bogus="1"></div><div>using namespace std;<br><br>typedef signed short PixelType;<br>typedef itk::Image< PixelType, 3> ImageType;<br>typedef itk::ImageSeriesReader< ImageType > ReaderType;<br>typedef itk::GDCMImageIO ImageIOType;<br>typedef itk::GDCMSeriesFileNames NamesGeneratorType;</div><div><br>ReaderType::Pointer dicomReader= ReaderType::New();<br><br>void ParseDicom(const string &dicomDirectory)<br>{<br> NamesGeneratorType::Pointer apNamesGenerator = NamesGeneratorType::New();<br> ImageIOType::Pointer apGdcmIO = ImageIOType::New();<br><br> apNamesGenerator->SetInputDirectory(dicomDirectory);</div><div><br> const ReaderType::FileNamesContainer & filenames =<br> apNamesGenerator->GetInputFileNames();</div><div><br><span style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">dicomReader</span>->SetImageIO(apGdcmIO);<br><span style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">dicomReader</span>->SetFileNames(filenames);<br> try<br> {<br><span style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">dicomReader</span>->Update();<br> }<br> catch (itk::ExceptionObject &excp)<br> {<br> std::cerr << "exception in file reader " << std::endl;<br> throw (excp);<br> }</div><div>}</div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><b>From: </b>"Dženan Zukić" <dzenanz@gmail.com><br><b>To: </b>"ritesh mahajan" <ritesh.mahajan@ripl.ricoh.com><br><b>Cc: </b>"insight-users" <insight-users@itk.org><br><b>Sent: </b>Tuesday, September 25, 2018 8:16:52 PM<br><b>Subject: </b>Re: [ITK] [ITK-users] ImageSeriesReader type pointer crashes in debug mode<br></div><div><br></div><div data-marker="__QUOTED_TEXT__"><div dir="ltr"><div class="gmail_default" style="font-family: verdana,sans-serif; font-size: small;" data-mce-style="font-family: verdana,sans-serif; font-size: small;">Hi Ritesh,</div><div class="gmail_default" style="font-family: verdana,sans-serif; font-size: small;" data-mce-style="font-family: verdana,sans-serif; font-size: small;"><br></div><div class="gmail_default" style="font-family: verdana,sans-serif; font-size: small;" data-mce-style="font-family: verdana,sans-serif; font-size: small;">When code crashes in Debug mode, but runs in Release or vice versa, it means it has a deficiency (bug) which manifests in one of those modes. As you did not provide the code which uses the reader, I cannot offer any more specific advice. Providing a <a href="http://sscce.org/" target="_blank">runnable</a> example will make it easier for people to help you.</div><div class="gmail_default" style="font-family: verdana,sans-serif; font-size: small;" data-mce-style="font-family: verdana,sans-serif; font-size: small;"><br></div><div class="gmail_default" style="font-family: verdana,sans-serif; font-size: small;" data-mce-style="font-family: verdana,sans-serif; font-size: small;"><div class="gmail_default">We have transitioned away from this list, to the <a href="https://discourse.itk.org/" target="_blank">forum</a>. Please post your updated question there, as more people will see it.</div><div class="gmail_default"><br></div><div class="gmail_default">Regards,</div><div class="gmail_default">Dženan</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 25, 2018 at 1:45 AM ritesh.mahajan <<a href="mailto:ritesh.mahajan@ripl.ricoh.com" target="_blank">ritesh.mahajan@ripl.ricoh.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;">Hello Team,<br>
<br>
When i am creating a smart pointer globally and allocating the memory to it.<br>
In debug mode "it crashes". While when the same code is run in release mode<br>
it seems to work fine. Can some one help me out why is it so ?<br>
<br>
Please find the below code:<br>
<br>
typedef signed short PixelType;<br>
typedef itk::Image< PixelType, 3>ImageType;<br>
typedef itk::ImageSeriesReader< ImageType >ReaderType;<br>
ReaderType:: Pointer reader= ReaderType::New();<br>
<br>
void ImageRead()<br>
{<br>
// using pointer reader here.<br>
// which is allocated memory at global level<br>
}<br>
<br>
The above code crashes in debug mode<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://itk-users.7.n7.nabble.com/" rel="noreferrer" target="_blank">http://itk-users.7.n7.nabble.com/</a><br>
The ITK community is transitioning from this mailing list to <a href="http://discourse.itk.org" rel="noreferrer" target="_blank">discourse.itk.org</a>. Please join us there!<br>
________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://itk.org/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">https://itk.org/mailman/listinfo/insight-users</a><br>
The ITK community is transitioning from this mailing list to <a href="http://discourse.itk.org" rel="noreferrer" target="_blank">discourse.itk.org</a>. Please join us there!<br>
________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org" target="_blank">Community@itk.org</a><br>
<a href="https://itk.org/mailman/listinfo/community" rel="noreferrer" target="_blank">https://itk.org/mailman/listinfo/community</a><br>
</blockquote></div><br></div></div></body></html>