[Insight-users] MRIBiasCorrection Example: problem reading meta files

Luis Ibanez luis . ibanez at kitware . com
Tue, 20 Aug 2002 08:46:43 -0400


Hi digvijay,

It seems that there is something wrong with the header of your
MetaImage file. For some reason the reader is not finding the
tag : "NDims" which is usually the first in the header.

I just tryied the example with the BrainWeb images of the ftp
site  ftp://public.kitware.com/pub/itk/Data/   and it worked
without problem. Here is the command line I used:

./IntensityHistogram3D.exe --file brainweb165a10f17.mha --bin-size 100

Looking closer to the command line in your email it looks like
the filename is missing, what you wrote looks more like a directory
(there is no .mha extension...).

Please try using the command line as above and let us know if
you encounter any problem,

Thanks

    Luis


====================================

digvijay singh wrote:
> hello luis and others
> i tried compiling the the MRIBiasCorrector Example(solaris8 gcc 2.95--) 
> and was able to do that successfully. However upon trying to run one of 
> the executables IntensityHistogram3D with the following usage:
> MRIBiasCorrection 1.0 (21.June.2001)
> usage: IntensityHistogram3D --file file
>        [--mask] file --bin-size double
> 
> --file file
>         image file [meta image format]
> --mask file
>         mask image. If mask is specified, this program
>         uses the pixels greater than zero only in the mask file
> --bin-size double
>         intensity interval
> 
> example: IntensityHistogram3D --file sampl.mhd
>          --mask sample.mask.mhd --bin-size 100
> 
> upon the command line:IntensityHistogram3D --file 
> /home/vertebra/digvijay/itk/proj_1/MRIBiasCorrection --bin-size 100
> i got the following error.
> 
> NDims required and not defined.
> MetaObject: Read: MET_Read Failed
> MetaImage: M_Read: Error parsing file
> MetaImage: Read: Cannot parse file
> 
> itk::ExceptionObject (0xffbeee88)
> Location: "Unknown"
> 
> The details of the file are
> NDims = 3
> DimSize = 181 217 180
> ElementType = MET_UCHAR
> ElementSpacing = 1.0 1.0 1.0
> ElementByteOrderMSB = False
> ElementDataFile = brainweb1e1a10f20.raw
> 
> i tried converting to mhd and reading from other examples as well from 
> the brainweb project but was not able to rectify the problem.
> Kindly advise.
> thanks
> digvijay
> 
> the cmakelists.txt file is:
> SET(ITK_SOURCE_DIR /home/encephalon/mstyner/itk/Insight_Nightly/Insight)
> SET(ITK_LIB_DIR /home/encephalon/mstyner/itk/Insight_Nightly/lib)
> SET(ITK_BINARY_DIR /home/encephalon/mstyner/itk/Insight_Nightly/build)
> 
> SET(HOME  /home/vertebra/digvijay)
> 
> SET(ITK_PROJECT_DIR ${HOME}/itk/proj_1/MRIBiasCorrection)
> 
> 
> INCLUDE (${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
> INCLUDE (${CMAKE_ROOT}/Modules/FindGLU.cmake)
> 
> 
> 
> 
> 
> LINK_DIRECTORIES( ${ITK_LIB_DIR} )
> 
> INCLUDE_DIRECTORIES(
> ${ITK_SOURCE_DIR}/Utilities
> ${ITK_SOURCE_DIR}/Utilities/MetaIO
> ${ITK_SOURCE_DIR}/Code/IO
> ${ITK_SOURCE_DIR}/Code/Common
> ${ITK_SOURCE_DIR}/Code/BasicFilters
> ${ITK_SOURCE_DIR}/Code/Algorithms
> ${ITK_SOURCE_DIR}/Code/Numerics
> ${ITK_SOURCE_DIR}/Code/Numerics/Statistics
> ${ITK_SOURCE_DIR}/Examples/MRIBiasCorrection
> ${ITK_SOURCE_DIR}/Code/Common
> ${ITK_SOURCE_DIR}/Code/BasicFilters
> ${ITK_SOURCE_DIR}/Code/Algorithms
> ${ITK_SOURCE_DIR}/Code/IO
> ${ITK_SOURCE_DIR}/Auxiliary/FltkImageViewer
> ${ITK_BINARY_DIR}/Auxiliary/FltkImageViewer
> ${ITK_SOURCE_DIR}/Code/Numerics/vxl
> ${ITK_SOURCE_DIR}/Code/Numerics/vxl/vcl
> ${ITK_BINARY_DIR}
> ${ITK_BINARY_DIR}/Code/Numerics/vxl/vcl
> ${ITK_PROJECT_DIR}
> 
> ${OPENGL_INCLUDE_PATH}
> )
> 
> SOURCE_FILES(ImageCorrector_SRCS
> OptionList.cxx
> ImageCorrector.cxx
> )
> 
> 
> SOURCE_FILES(BiasImageGenerator_SRCS
> OptionList.cxx
> BiasImageGenerator.cxx
> )
> 
> 
> SOURCE_FILES(BiasFieldEstimator_SRCS
> OptionList.cxx
> BiasFieldEstimator.cxx
> )
> 
> SOURCE_FILES(InterSliceIntensityCorrector_SRCS
> OptionList.cxx
> InterSliceIntensityCorrector.cxx
> )
> 
> SOURCE_FILES(IntensityHistogram3D_SRCS
> OptionList.cxx
> IntensityHistogram3D.cxx
> )
> 
> SOURCE_FILES(SlabIdentifier_SRCS
> OptionList.cxx
> SlabIdentifier.cxx
> )
> 
> SOURCE_FILES(EnergyTablePlotter_SRCS
> OptionList.cxx
> EnergyTablePlotter.cxx
> )
> 
> 
> SOURCE_FILES(BiasCorrector_SRCS
> OptionList.cxx
> BiasCorrector.cxx
> )
> 
> LINK_DIRECTORIES(
> ${ITK_BINARY_DIR}/Code/BasicFilters
> ${ITK_BINARY_DIR}/Code/Numerics
> ${ITK_BINARY_DIR}/Code/Numerics/Statistics
> ${ITK_BINARY_DIR}/Code/IO
> )
> 
> 
> LINK_DIRECTORIES( ${ITK_LIB_DIR} )
> 
> LINK_LIBRARIES (
> ITKCommon
> ITKIO
> ITKBasicFilters
> ITKStatistics
> ITKNumerics
> MetaIO
> VXLNumerics
> VXLNumerics
> ITKAlgorithms
> ITKBasicFilters
> ITKNumerics
> itkpng
> ITKStatistics
> MetaIO
> itkzlib
> param
> vtkFltk
> FltkImageViewer
> FEM
> ITKCommon
> ${FLTK_LIBRARY}
> ${OPENGL_LIBRARY}
> ${GLU_LIBRARY}
> -lpthread -ldl -lm
> 
> )
> 
> ADD_DEFINITIONS(-ftemplate-depth-50 -D_PTHREADS)
> 
> 
> ADD_EXECUTABLE(BiasFieldEstimator BiasFieldEstimator_SRCS)
> ADD_EXECUTABLE(BiasImageGenerator BiasImageGenerator_SRCS)
> ADD_EXECUTABLE(IntensityHistogram3D IntensityHistogram3D_SRCS)
> ADD_EXECUTABLE(InterSliceIntensityCorrector 
> InterSliceIntensityCorrector_SRCS)
> ADD_EXECUTABLE(SlabIdentifier SlabIdentifier_SRCS)
> ADD_EXECUTABLE(EnergyTablePlotter EnergyTablePlotter_SRCS)
> ADD_EXECUTABLE(ImageCorrector ImageCorrector_SRCS)
> ADD_EXECUTABLE(BiasCorrector BiasCorrector_SRCS)
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>