[Insight-users] Analyze Image Orientation problem
Oleksandr Dzyubak
adzyubak at gmail.com
Tue Mar 31 18:49:12 EDT 2009
Hi Luis,
Thanks for quick response.
a) I have to use the Analyze format in my image processing.
b) I agree that pixel type Long is not a must.
c) At the last resort I would use image cast in a filter pipeline.
d) I have downloaded and tried the attachment with your corrections.
So I deleted my working directory and started all over.
1) If I use your attachment "as is", I get the runtime error message
below.
********** Runtime Error *********
From writer: ExceptionObject caught !
itk::ExceptionObject (0x9923830)
Location: "void itk::AnalyzeImageIO::DefineHeaderObjectDataType()"
File:
/mnt/Public/Root_BUILDS/Lenny/InsightToolkit_3_12/InsightToolkit-3.12.0/Code/IO/itkAnalyzeImageIO.cxx
Line: 630
Description: itk::ERROR: AnalyzeImageIO(0x9923840): Pixel Type Unknown
real 62m59.119s
user 59m44.896s
sys 0m14.581s
*********
2) And I get a compile error if I make a change in "main".
typedef itk::Image<unsigned short, 3> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
typedef itk::JunctionDetectionFilter<ImageType> DetectorType;
// typedef itk::ImageFileWriter<DetectorType::OutputImageType> WriterType;
typedef itk::ImageFileWriter<ImageType> WriterType;
************ Compile Error ********
/mnt/Public/Programs/ITK_Test/Skeletons/Automatic_Junction_Detection/Src/itkJunctionDetectionFilter3DTest.cxx:
In function ‘int main(int, char**)’:
/mnt/Public/Programs/ITK_Test/Skeletons/Automatic_Junction_Detection/Src/itkJunctionDetectionFilter3DTest.cxx:83:
error: no matching function for call to
‘itk::ImageFileWriter<itk::Image<short unsigned int, 3u>
>::SetInput(itk::Image<long int, 3u>*)’
/usr/local/include/InsightToolkit/IO/itkImageFileWriter.txx:58: note:
candidates are: void itk::ImageFileWriter<TInputImage>::SetInput(const
TInputImage*) [with TInputImage = itk::Image<short unsigned int, 3u>]
make[2]: ***
[CMakeFiles/itkJunctionDetectionFilter3DTest.dir/itkJunctionDetectionFilter3DTest.o]
Error 1
make[1]: *** [CMakeFiles/itkJunctionDetectionFilter3DTest.dir/all] Error 2
make: *** [all] Error 2
**********
Regards,
Alex
Luis Ibanez wrote:
>
> Hi Oleksandr,
>
>
> It seems that you are getting two separate errors.
>
>
>
> A) The first one is a warning and refers to image orientation.
> In this case, I would suggest to simply not use the Analyze
> file format. Have you considered using nifti ?
>
>
> B) The second one is also a limitation on the pixel
> type supported by Analyze. The Junction filter uses
> Long as the pixel type of the output image. This seems
> to be an unnecessary restriction though.
>
> The simple solution is to make the filter templated also
> over the output image type, and to provide the current
> output image type as the default for that template argument.
>
> Please find attached the modified files, in which you
> can replace the output image type for the junction filter.
>
>
>
> C) The compilation error that you are reporting indicates
> that you are not declaring consistently the image type
> at the output of the filter, and the corresponding
> file writer.
>
> if you are going to connect:
>
> writer->SetInput( filter->GetOutput() )
>
> the the output of the filter *must* be of the same type
> as the image type of the writer, *or* you could use a
> cast image filter in the middle.
>
> The Junction filter is templated only over the input
> image type, therfore, it looks like you would have to
> go for inserting a CastImageFilter between the junction
> filter and the writer (if you want to use the Analyze
> file format).
>
> Or.... use the attached files.
>
>
>
> Regards,
>
>
> Luis
>
>
> -----------------------
> Oleksandr Dzyubak wrote:
>> Quick question though. I am mostly working with the Analyze format
>> images.
>> I know that is an additional headache but...
>>
>> So if I just run the program as above but with the Analyze format
>> images,
>> I am getting an "exception caught":
>>
>> ========================WARNING: In
>> /mnt/Public/Root_BUILDS/Lenny/InsightToolkit_3_12/InsightToolkit-3.12.0/Code/IO/itkAnalyzeImageIO.cxx,
>> line 1345
>> AnalyzeImageIO (0x86fb840): ERROR: Analyze 7.5 File Format Only
>> Allows RPI, PIR, and RIP Orientation
>>
>> ExceptionObject caught !
>>
>> itk::ExceptionObject (0x86fb830)
>> Location: "void itk::AnalyzeImageIO::DefineHeaderObjectDataType()"
>> File:
>> /mnt/Public/Root_BUILDS/Lenny/InsightToolkit_3_12/InsightToolkit-3.12.0/Code/IO/itkAnalyzeImageIO.cxx
>>
>> Line: 630
>> Description: itk::ERROR: AnalyzeImageIO(0x86fb840): Pixel Type Unknown
>> ==========================
>>
>> On the other hand if I change the typedef to fit into the Analyze
>> requirements,
>>
>> typedef itk::Image<unsigned short, 3> ImageType;
>> typedef itk::ImageFileReader<ImageType> ReaderType;
>> typedef itk::JunctionDetectionFilter<ImageType>
>> DetectorType;
>> // typedef itk::ImageFileWriter<DetectorType::OutputImageType>
>> WriterType;
>> typedef itk::ImageFileWriter<ImageType> WriterType;
>>
>> I am getting the compile error:
>>
>> ****************** Begin Error ***********
>>
>> [100%] Building CXX object
>> CMakeFiles/itkJunctionDetectionFilter3DTest.dir/itkJunctionDetectionFilter3DTest.o
>>
>> /mnt/Public/Programs/ITK_Test/Skeletons/Automatic_Junction_Detection/Src/itkJunctionDetectionFilter3DTest.cxx:
>> In function ‘int main(int, char**)’:
>> /mnt/Public/Programs/ITK_Test/Skeletons/Automatic_Junction_Detection/Src/itkJunctionDetectionFilter3DTest.cxx:83:
>> error: no matching function for call to
>> ‘itk::ImageFileWriter<itk::Image<short unsigned int, 3u>
>> >::SetInput(itk::Image<short int, 3u>*)’
>> /usr/local/include/InsightToolkit/IO/itkImageFileWriter.txx:58: note:
>> candidates are: void
>> itk::ImageFileWriter<TInputImage>::SetInput(const TInputImage*) [with
>> TInputImage = itk::Image<short unsigned int, 3u>]
>> make[2]: ***
>> [CMakeFiles/itkJunctionDetectionFilter3DTest.dir/itkJunctionDetectionFilter3DTest.o]
>> Error 1
>> make[1]: *** [CMakeFiles/itkJunctionDetectionFilter3DTest.dir/all]
>> Error 2
>> make: *** [all] Error 2
>>
>> ****************** End Error ***********
>>
>> Any solution for that?
>>
>> Thanks,
>> Alex
>>
>> Luis Ibanez wrote:
>>
>>>
>>> Hi Oleksandr,
>>>
>>> I just finished reviewing this paper:
>>> http://www.insight-journal.org/browse/publication/324
>>>
>>> The code was missing a bunch of "typename" keywords,
>>> which is the usual problem of code developed in Windows
>>> with Visual Studio 6.0.
>>>
>>> Please find attached the .tgz file with the corrections
>>> required to compile it in GCC. (gcc 4.3.2, GNU/Linux
>>> Ubuntu 8.10).
>>>
>>> Please give it a try at this modified code and let us
>>> know if you find any problem.
>>>
>>> Note that you should compile this code for Release,
>>> and allow it to run for at least 15min for the 2D
>>> case, for it to finish processing the image.
>>>
>>>
>>> BTW: If you find the paper useful, please take the
>>> time of contributing a review for it. In this way
>>> we will be able to integrate this paper code into
>>> ITK in the near future.
>>>
>>>
>>>
>>> Regards,
>>>
>>>
>>> Luis
>>>
>>>
>>>
>>> ---------------------------
>>> Oleksandr Dzyubak wrote:
>>>
>>>> Thanks Luis,
>>>>
>>>> You were right on that one. So we are getting close.
>>>> Now I am getting a family of errors as below concerning
>>>> the variable "was not declared in this scope"...
>>>>
>>>> ********* Errors begin ********
>>>> itkJunctionDetectionFilter.txx:78: error: expected `;' before
>>>> ‘wallDister’
>>>> itkJunctionDetectionFilter.txx:79: error: ‘wallDister’ was not
>>>> declared in this scope
>>>> .......
>>>> etc.
>>>> ********* Errors end ********
>>>>
>>>> Alex
>>>>
>>
>>
More information about the Insight-users
mailing list