[Insight-users] Convert NRRD into DICOM

Ezequiel Geremia t-egerem at microsoft.com
Fri Jul 3 05:48:23 EDT 2009


Hi,

Thank you, I appreciate your support on this question.

The images are volumes dimensions: ( 512, 512, 512 ) and pixel type is short.

While trying to run the task manager with the ITK conversion executable there is no jump in RAM usage, this is why I think the RAW volume is not even loaded in memory, the reader just does not find it.

My understanding is that there is no memory problem, indeed I manage to load the same image with the same executable just by moving to the directory containing the NRRD volumes.

Many thanks,

Ezequiel

From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: 02 July 2009 23:56
To: Ezequiel Geremia
Cc: itk
Subject: Re: [Insight-users] Convert NRRD into DICOM


Hi Ezequiel,

Thanks for posting the error message from the Exception.

I just verified that a NRRD header file can be moved along
with its associated .raw file to a different directory and still
be read with the NRRD reader included into ITK.

--


Looking at the code...

  ...(Ah!, the Unbeatable Glory of Open Source)...

We find that the error message that you posted is being
generated by line 161 of:

            Insight/Utilities/NrrdIO/formatNRRD.c

that curiously is part of (160-165):

      if ((err = (char*)malloc(strlen(fname) + AIR_STRLEN_MED))) {
        sprintf(err, "%s: couldn't open \"%s\" (data file %d of %d) for %s",
                me, fname, nio->dataFNIndex+1, (int)_nrrdDataFNNumber(nio),
                reading ? "reading" : "writing");
        biffAdd(NRRD, err); free(err);
      }



Admittedly,
the error message is quite misleading here...

It is clear that what is happening in these lines above
is that the code is failing to allocate enough memory
for your image.

So...
please tell us:


       A)  How big is the image ?

       B)  How much RAM do you have ?


and please run this code while you have open the
TaskManager, and check on how much memory
is available at the time the program post this message.


If memory allocation turns out to be the real problem,
please feel free to add a bug report suggesting
that this error message be replaced with something
that indicates that we are dealing with a Memory
Allocation problem, as opposed to an I/O problem.

You can report bugs at:
http://public.kitware.com/Bug/my_view_page.php




     Please let us know what you find,


           Thanks


                  Luis


-----------------------------------------------------------------------------
On Thu, Jul 2, 2009 at 1:31 PM, Ezequiel Geremia <t-egerem at microsoft.com<mailto:t-egerem at microsoft.com>> wrote:
Hi Luis,

The reader.Update() call is inside a try\catch block.

Here is the exception which is caught:

ExceptionObject caught !

itk::ExceptionObject (00A0E9A8)
Location: "void __thiscall itk::NrrdImageIO::ReadImageInformation(void)"
File: ..\..\..\src\Code\IO\itkNrrdImageIO.cxx
Line: 264
Description: itk::ERROR: NrrdImageIO(025D1DC0): ReadImageInformation: Error read
ing C:\Downloads\MS-Lesion-Segmentation-2008\Extracted-Files\Test
ing-Data\CHB_test1_Part1\CHB_test1_Case01\CHB_test1_Case01_FLAIR.nhdr:
[nrrd] nrrdLoad: trouble reading "C:\Downloads\MS-Lesion-Segmenta
tion-2008\Extracted-Files\Testing-Data\CHB_test1_Part1\CHB_test1_Case01\CHB_test
1_Case01_FLAIR.nhdr"
[nrrd] nrrdRead: trouble reading NRRD file
[nrrd] _nrrdFormatNRRD_read: couldn't open the first datafile
[nrrd] nrrdIoStateDataFileIterNext: couldn't open "./CHB_test1_Case01_FLAIR.raw"
 (data file 1 of 1) for reading

In this case, the reader does not seem to add the path of the header file (i.e. "C:\Downloads\MS-Lesion-Segmentation-2008\Extracted-Files\Testing-Data\CHB_test1_Part1\CHB_test1_Case01\") to the filename found in the header file and which is in the same directory (i.e. "./CHB_test1_Case01_FLAIR.raw").

Many thanks,

Ezequiel

-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com<mailto:luis.ibanez at kitware.com>]
Sent: 02 July 2009 17:51
To: Ezequiel Geremia; Insight Users
Subject: Re: [Insight-users] Convert NRRD into DICOM


Hi Ezequiel,

Thanks for the update.

I haven't seen this problem before.

I would be very surprised if the reader relies on absolute
paths, because that will mean that it is impossible to
move NRRD files from one computer to another,... and even
from one directory to another in the same machine.



Did you got an error message ?

If so,
Could you please post it to the mailing list ?

Are you placing the Update() call of the reader
inside a try/catch block ?



  Please let us konw


     Thanks


       Luis


------------------------
Ezequiel Geremia wrote:
> Hi Luis,
>
> Thank you for answering my mail,
>
> I managed to read NRRD format by passing the header .nhdr or .mhd files and to convert them into DICOM series.
>
> The NRRD format I got form the MS Segmentation Challenge 2008 & Liver Tumor Segmentation Challenge 2008 websites seem to be specified as the union of a header and a RAW data file.
>
> However I experienced another issue concerning the reader. When I pass the header, which contains the relative filename of the .raw file to be converted, as an input, the reader is not able to find it (maybe because the reader relies on absolute filenames).
>
> Do you know a way out of this ?
>
> Regards,
>
> Ezequiel
>
>
>
> -----Original Message-----
> From: Luis Ibanez [mailto:luis.ibanez at kitware.com<mailto:luis.ibanez at kitware.com>]
> Sent: 30 June 2009 22:27
> To: Ezequiel Geremia
> Cc: insight-users at itk.org<mailto:insight-users at itk.org>
> Subject: Re: [Insight-users] Convert NRRD into DICOM
>
>
>
> Hi Ezequiel,
>
>
>      If your input file is in NRRD format,
>      why are you passing a RAW format as input ?
>
>
> ITK is expecting that a NRRD file will be called
>
>                LTS_IMG05.nrrd
>
> not to be called:
>
>                LTS_IMG05.raw
>
>
>
> Also, is this image 2D or 3D ?
>
>
> You may have to retouch the example code in order
> to manage 3D images.
>
>
>     Regards,
>
>
>         Luis
>
>
> --------------------------
> Ezequiel Geremia wrote:
>
>>Hi,
>>
>>
>>
>>I tried to convert NRRD, which is ITK supported format, data volumes
>>into DICOM volumes using the generic converter given in
>>/ImageReadWrite.exe/ with the following arguments
>>
>>-          Input file: LTS_IMG05.raw
>>
>>-          Output file: LTS_IM05.dcm (also tried .dic and .dicom file
>>extensions)
>>
>>-          Exception:
>>
>>itk::ImageFileReaderException (0146EEC0)
>>
>>Location: "void __thiscall itk::ImageFileReader<class
>>itk::Image<short,3>,class itk::DefaultConvertPixelTraits<short>
>> >::GenerateOutputInformation(void)"
>>
>>File:
>>c:\users\t-egerem\software\insighttoolkit-3.14.0\src\code\io\itkImageFileReader.txx
>>
>>Line: 144
>>
>>Description:  Could not create IO object for file
>>C:\Users\t-egerem\Downloads\3D-Liver-Tumor-Segmentation-Challenge-2008\Extracted-Files\Testing-Data\LTS_IMG05.raw
>>
>>  Tried to create one of the following:
>>
>>    GDCMImageIO
>>
>>    MetaImageIO
>>
>>    PNGImageIO
>>
>>    VTKImageIO
>>
>>    GiplImageIO
>>
>>    BioRadImageIO
>>
>>    LSMImageIO
>>
>>    AnalyzeImageIO
>>
>>    NiftiImageIO
>>
>>    StimulateImageIO
>>
>>    JPEGImageIO
>>
>>    TIFFImageIO
>>
>>    NrrdImageIO
>>
>>    BMPImageIO
>>
>>    DICOMImageIO2
>>
>>  You probably failed to set a file suffix or set the suffix to an
>>unsupported type.
>>
>>
>>
>>Then I tried to shortcut the pluggable factory mechanism and it does not
>>as well with the same data it throws the following error message
>>
>>                itk::ExceptionObject (0122F614)
>>
>>Location: "void __thiscall itk::ImageFileReader<class
>>itk::Image<short,3>,class itk::DefaultConvertPixelTraits<short>
>> >::EnlargeOutputRequestedRegion(class itk::DataObject *)"File:
>>c:\users\t-egerem\software\insighttoolkit-3.14.0\src\code\io\itkImageFileReader.txx
>>
>>Line: 342
>>
>>Description: itk::ERROR: ImageFileReader(0172F7C0): ImageIO returns IO
>>region that does not fully contain the requested regionRequested region:
>>ImageRegion (0122F8D8)
>>
>>  Dimension: 3
>>
>>  Index: [0, 0, 0]
>>
>>  Size: [0, 0, 0]
>>
>>StreamableRegion region: ImageRegion (0172F8A4)
>>
>>  Dimension: 3
>>
>>  Index: [0, 0, 0]
>>
>>  Size: [0, 0, 0]
>>
>>
>>
>>If you can think of a solution can you please point it out to me ?
>>
>>
>>
>>Regards,
>>
>>
>>
>>Ezequiel Geremia
>>
>>
>>
>>
>>------------------------------------------------------------------------
>>
>>_____________________________________
>>Powered by www.kitware.com<http://www.kitware.com>
>>
>>Visit other Kitware open-source projects at
>>http://www.kitware.com/opensource/opensource.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
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090703/33d7ef5d/attachment-0001.htm>


More information about the Insight-users mailing list