[Insight-users] Reading LSM images

Jesse Stokum jessestokum at gmail.com
Sat Feb 13 16:21:33 EST 2010


Luis,

I've surrounded my reader->update() line with a try, catch block that
catches itk::ExceptionObject. It doesn't seem to be even getting to
the catch block- simple std::cout statements inside the catch block
are not showing. The following unhandled exception appears however
when I run my program on the vs debugger:

The thread 'Win32 Thread' (0x1a7c) has exited with code 0 (0x0).
Unhandled exception at 0x00b0a890 in CellSegment.exe: 0xC0000005:
Access violation writing location 0x08fc0040.

The breakpoint that is detected by vs is in line 1116 of the class
itkTIFFImageIO.cxx.

Thanks,

Jesse



On Sat, Feb 13, 2010 at 3:38 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> Hi Jesse,
>
> Thanks for the clarification.
>
> You are right, if the 3D image is in a single file, then
> using the ImageFileReader is the correct way to
> proceed.
>
> Could you please post to the list the exact text
> that you get from the Exceptions ?
>
> If you need examples on how to catch exceptions
> and print their error messages, you will find many
> of them in the directories under
>
>                     Insight/Examples
>
>
>     Thanks
>
>
>             Luis
>
>
> -----------------------------------------------------------------
> On Sat, Feb 13, 2010 at 12:33 PM, Jesse Stokum <jessestokum at gmail.com> wrote:
>> Luis,
>>
>> Thanks for the quick reply, I really appreciate it. The lsm image
>> stack that I'm working with are actually all in a single file - which
>> is why I hesitated to use the ImageSeriesReader for this one. I
>> suppose I could always split the stack into a series of slices imagej
>> or something else, but it would be more time efficient to just read in
>> the entire file. Also, intuitively I think that I would get better
>> filtering results if I handled it as a 3d image, though I could be
>> wrong about that. Thanks!
>>
>> Jesse
>>
>> On Fri, Feb 12, 2010 at 5:07 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>>> Hi Jesse,
>>>
>>>
>>> If you have the images in independent files (one file per slice),
>>> you should use the itk::ImageSeriesReader (instead of the
>>> itk::ImageFileReader).
>>>
>>>
>>> The LSM reader in ITK should be able to manage three channels
>>> (three components per pixel).
>>>
>>> You will find examples on how to use the ImageSeriesReader
>>> in the ITK Software Guide
>>>
>>>                   http://www.itk.org/ItkSoftwareGuide.pdf
>>>
>>> in the chapter "Reading and Writing Images",
>>>
>>> and you will find source code examples in the directory:
>>>
>>>                           Insight/Examples/IO
>>>
>>> in particular, you may find interesting the example:
>>>
>>>            RGBImageSeriesReadWrite.cxx
>>>
>>> you probably only need to replace there the PNGImageIO
>>> class with a LSMImageIO class.
>>>
>>>
>>> Please give it a try and let us know if you find any problems.
>>>
>>> BTW: I you get any Exceptions, please post to the list
>>> the *exact* error message that you get from the exception.
>>>
>>>
>>>     Thanks
>>>
>>>
>>>
>>>           Luis
>>>
>>>
>>>
>>> -------------------------------------------------------------------------------------
>>> On Fri, Feb 12, 2010 at 12:34 PM, Jesse Stokum <jessestokum at gmail.com> wrote:
>>>> I'm trying to use ITK's ImageFileReader to read in LSM format images
>>>> and my code is abruptly throwing exceptions. The images are three
>>>> channel, and are ~30 slices. Should I consider them 3d images? Here's
>>>> the code in my main() I've been trying:
>>>>
>>>>        typedef itk::RGBPixel<unsigned char> PixelType;
>>>>        typedef itk::Image<PixelType, 3> ImageType;
>>>>
>>>>        typedef itk::ImageFileReader<ImageType> ReaderType;
>>>>        typedef itk::LSMImageIO ImageIOType;
>>>>        typedef itk::ImageFileWriter<ImageType> WriterType;
>>>>
>>>>        ReaderType::Pointer reader = ReaderType::New();
>>>>        ImageIOType::Pointer lsmImageIO = ImageIOType::New();
>>>>        reader->SetImageIO(lsmImageIO);
>>>>        reader->SetFileName("Tests.lsm");
>>>>
>>>> Are lsm pixels vector pixels? I guess I'm just unsure how to handle
>>>> this situation. Thanks in advance!
>>>> _____________________________________
>>>> 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