<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt"><PRE style="LINE-HEIGHT: normal; WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; ORPHANS: 2; COLOR: ; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Hi,</PRE><PRE style="LINE-HEIGHT: normal; WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; ORPHANS: 2; COLOR: ; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">I'm trying to register one set of DICOM and one Nrrd file.</PRE><PRE style="LINE-HEIGHT: normal; WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; ORPHANS: 2; COLOR: ; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">I’ve used the exemple : ImageRegistration8, which use “mha” files.</PRE><PRE style="LINE-HEIGHT: normal; WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; ORPHANS: 2; COLOR: ; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">I just want to replace the two mha files by my DICOM serie and my nrrd file.</PRE><PRE style="LINE-HEIGHT: normal; WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; ORPHANS: 2; COLOR: ; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">So I replace this part of code :</PRE>
<DIV>typedef itk::ImageFileReader< FixedImageType >
FixedImageReaderType;</DIV>
<DIV>typedef itk::ImageFileReader< MovingImageType >
MovingImageReaderType;</DIV>
<DIV>FixedImageReaderType::Pointer fixedImageReader =
FixedImageReaderType::New();</DIV>
<DIV>MovingImageReaderType::Pointer movingImageReader =
MovingImageReaderType::New();</DIV>
<DIV>fixedImageReader->SetFileName( argv[1] );</DIV>
<DIV>movingImageReader->SetFileName( argv[2] );</DIV>
<DIV>registration->SetFixedImage(
fixedImageReader->GetOutput() );</DIV>
<DIV>registration->SetMovingImage(
movingImageReader->GetOutput() );</DIV>
<DIV>fixedImageReader->Update();</DIV>
<DIV>registration->SetFixedImageRegion(</DIV>
<DIV> fixedImageReader->GetOutput()->GetBufferedRegion()
);</DIV><PRE style="LINE-HEIGHT: normal; WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; ORPHANS: 2; COLOR: ; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"> </PRE><PRE style="LINE-HEIGHT: normal; WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; ORPHANS: 2; COLOR: ; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"> </PRE><PRE style="LINE-HEIGHT: normal; WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; ORPHANS: 2; COLOR: ; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">By this (loading) part :</PRE><PRE style="LINE-HEIGHT: normal; WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; ORPHANS: 2; COLOR: ; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"> </PRE>
<DIV> typedef itk::ImageSeriesReader< FixedImageType >
FixedImageReaderType;</DIV>
<DIV> typedef itk::ImageFileReader< MovingImageType >
MovingImageReaderType;</DIV>
<DIV> FixedImageReaderType::Pointer
fixedImageReader = FixedImageReaderType::New();</DIV>
<DIV> MovingImageReaderType::Pointer movingImageReader =
MovingImageReaderType::New();</DIV>
<DIV> </DIV>
<DIV>/* fixedImageReader->SetFileName( argv[1]
);</DIV>
<DIV> movingImageReader->SetFileName( argv[2] );*/</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> registration->SetFixedImage(
fixedImageReader->GetOutput() );</DIV>
<DIV> registration->SetMovingImage(
movingImageReader->GetOutput() );</DIV>
<DIV> </DIV>
<DIV> // lecture première image (DICOM)</DIV>
<DIV> std::cout << "Le fichier " << argv[1]
<< " est une serie de DICOM " << std::endl;</DIV>
<DIV> </DIV>
<DIV> typedef itk::GDCMImageIO ImageIOType; // une image
DICOM</DIV>
<DIV> typedef itk::GDCMSeriesFileNames
InputNamesGeneratorType;</DIV>
<DIV> </DIV>
<DIV> // DICOM LOADING</DIV>
<DIV> ImageIOType::Pointer gdcmIO = ImageIOType::New();</DIV>
<DIV> </DIV>
<DIV> // on crée le générateur de noms de fichier</DIV>
<DIV> InputNamesGeneratorType::Pointer namesGenerator =
InputNamesGeneratorType::New();</DIV>
<DIV> // on indique au générateur de nom le dossier
d'entrée</DIV>
<DIV> namesGenerator->SetInputDirectory( argv[1] );</DIV>
<DIV> // on récupère à présent la liste des fichiers à
lire</DIV>
<DIV> const FixedImageReaderType::FileNamesContainer &
filenames =</DIV>
<DIV>
namesGenerator->GetInputFileNames();</DIV>
<DIV> </DIV>
<DIV> // on lui indique que ce sont des DICOM</DIV>
<DIV> fixedImageReader->SetImageIO( gdcmIO );</DIV>
<DIV> // on lui fournit la liste des fichiers à charger</DIV>
<DIV> fixedImageReader->SetFileNames( filenames );</DIV>
<DIV> try</DIV>
<DIV> {// on lance le processus de lecture</DIV>
<DIV>
fixedImageReader->Update();</DIV>
<DIV> }</DIV>
<DIV> catch (itk::ExceptionObject &excp)</DIV>
<DIV> {</DIV>
<DIV> std::cerr << "Exception
thrown while reading the series" << std::endl;</DIV>
<DIV> std::cerr << excp <<
std::endl;</DIV>
<DIV> }</DIV>
<DIV> std::cout << "The input
series in directory " << argv[1]</DIV>
<DIV> << " has " <<
fixedImageReader->GetFileNames().size() << " files "</DIV>
<DIV> << " of size " <<
fixedImageReader->GetOutput()->GetBufferedRegion().GetSize()</DIV>
<DIV> << std::endl;</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> // lecture deuxieme image (nrrd)</DIV>
<DIV> typedef itk::NrrdImageIO nrrdType; // une image
nrrd</DIV>
<DIV> </DIV>
<DIV> std::cout << "Le fichier " <<
argv[2] << " est un nrrd" << std::endl;</DIV>
<DIV> </DIV>
<DIV> // nrrd LOADING</DIV>
<DIV> nrrdType::Pointer nrrdIO = nrrdType::New();</DIV>
<DIV> // on lui indique que ce sont des nrrd</DIV>
<DIV> movingImageReader->SetImageIO( nrrdIO );</DIV>
<DIV> // on lui fournit la liste des fichiers à charger</DIV>
<DIV> movingImageReader->SetFileName( argv[2]
);</DIV>
<DIV> try</DIV>
<DIV> {// on lance le processus de lecture</DIV>
<DIV>
movingImageReader->Update();</DIV>
<DIV> }</DIV>
<DIV> catch (itk::ExceptionObject &excp)</DIV>
<DIV> {</DIV>
<DIV> std::cerr << "Exception
thrown while reading the series" << std::endl;</DIV>
<DIV> std::cerr << excp <<
std::endl;</DIV>
<DIV> }</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> fixedImageReader->Update();</DIV>
<DIV> registration->SetFixedImageRegion(</DIV>
<DIV>
fixedImageReader->GetOutput()->GetBufferedRegion() );</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>//////////////////////////// end of loading</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New">when I use these loading I had a bad alloc error
at calling “update()” methode of the registration...</FONT></DIV>
<DIV><FONT face="Courier New">when I try to register the nrrd on the other same
nrrd, I’ve no problem : the soft do one iteration and stop with error =
0.</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New">So the problem seem to come from the
DICOM...</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New">I join you my code,</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New">Regards,</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New">Guilhem</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV></DIV></DIV></BODY></HTML>