[Insight-users] Crash on simple application in Release

Daanen Vincent daanen at koelis.com
Mon May 24 11:51:44 EDT 2010


Hi Luis,

You're right but this change does not fix the problem since, as I wrote in
the initial msg, the crash occurs on the creation of the reader ...
Any idea ?

Regards

V  

> -----Message d'origine-----
> De : Luis Ibanez [mailto:luis.ibanez at kitware.com] 
> Envoyé : lundi 24 mai 2010 17:28
> À : Daanen Vincent
> Cc : Insight Users Mailing List
> Objet : Re: [Insight-users] Crash on simple application in Release
> 
> Hi Vincent,
> 
> What is wrong with the function is that the p_pImg
> argument should be passed by reference.
> 
> You are now passing it by copy, so it doesn't really
> return anything.
> 
> Instead of
> > bool ReadAsAnalyze(typename ITK_IMAGE::Pointer p_pImg, 
> const char *p_pName)
> 
> you should do
> > bool ReadAsAnalyze(typename ITK_IMAGE::Pointer & p_pImg, 
> const char *p_pName)
> 
> 
> 
>     Regards,
> 
> 
>           Luis
> 
> 
> ------------------------------------
> On Mon, May 24, 2010 at 10:25 AM, Daanen Vincent 
> <daanen at koelis.com> wrote:
> > Hi all,
> >
> > I want to use Itk image loading capabilities.
> > This simple program crashes ** in release (it's ok in 
> debug) ** on the
> > itk::ImageFileReader constructor 80
> >
> > What's wrong with the so simple program ?
> >
> >
> > template <class ITK_IMAGE>
> > bool ReadAsAnalyze(typename ITK_IMAGE::Pointer p_pImg, 
> const char *p_pName)
> > {
> >        typedef ITK_IMAGE TImage;
> >        typedef itk::ImageFileReader< TImage > ReaderType;
> >        typedef itk::AnalyzeImageIO ImageIOType;
> >
> >        ReaderType::Pointer reader = ReaderType::New();
> >        ImageIOType::Pointer AnalyzeImageIO = ImageIOType::New();
> >        reader->SetFileName(p_pName);
> >
> >        try {
> >                reader->Update();
> >                p_pImg = reader->GetOutput();
> >
> >        }
> >        catch( itk::ExceptionObject & err ) {
> >                std::cerr << "ExceptionObject caught !" << std::endl;
> >                std::cerr << err << std::endl;
> >                return false;
> >        }
> >
> >        return true;
> > }
> >
> >
> > int main(int argc, char **argv)
> > {
> >        typedef itk::Image<WORD,3> TImage;
> >        TImage::Pointer l_pImg = TImage::New();
> >
> >
> > 
> ReadAsAnalyze<TImage>(l_pImg,InExePath("..\\..\\Doc\\JESSAI\\C
> oronal_Anisotr
> > opic.hdr"));
> > }
> >
> >
> > My platform is Visual Studio 2005/ Windows XP SP3
> >
> > Thanks for any help
> >
> >  V
> > --------------------------------------------
> > Vincent Daanen, PhD
> > D&D Manager
> >
> > --------------------------------------------
> > KOELIS
> > 5, avenue du Grand Sablon 38700 La Tronche
> > www.koelis.com  -  daanen at koelis.com
> > Tel .+33(0) 476637588 Fax .+33(0) 476637592
> > --------------------------------------------
> >
> > CONFIDENTIALITY This e-mail and any attachments are 
> confidential and may
> > also be privileged. If you are not the named recipient, 
> please notify the
> > sender immediately and do not disclose the contents to 
> another person, use
> > it for any purpose, or store or copy the information in any medium.
> >
> > "Les problèmes ne peuvent être résolus par ceux dont 
> l'horizon se limite aux
> > réalités quotidiennes,  mais par ceux qui rêvent de choses 
> qui n'ont jamais
> > existé et qui se disent : Pourquoi Pas ?" (J-F Kennedy, 1963).
> >
> > _____________________________________
> > 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.html
> >
> > 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://www.itk.org/mailman/listinfo/insight-users
> >



More information about the Insight-users mailing list