ITK/FAQ: Difference between revisions

From KitwarePublic
< ITK
Jump to navigationJump to search
 
(169 intermediate revisions by 30 users not shown)
Line 1: Line 1:
== General information and availability ==
== General information and availability ==
=== Do I need FLTK to build ITK ? ===
No,
ITK does not require FLTK. FLTK is only used in particular demo applications in the InsightApplications directory.
ITK does not provide any GUI functionality. When building full applications, the GUI is provided by other libraries such as Qt (http://www.trolltech.com/products/qt/index.html), FLTK (http://www.fltk.org/) Gtk+ (http://www.gtk.org/) or wxWidgets (http://www.wxwidgets.org/, which used to be called wxWindows).
If you want to build the demo applications that require FLTK, you must install FLTK in your system. The recomended version is 1.1.3 that can be obtained from ftp.fltk.org and from the "RelatedSoftware" page in www.itk.org.
Once FLTK is installed in your system, you will have to enable the USE_FLTK option when you run CMake to configure ITK.


=== Do I need VTK to build ITK ? ===
=== Do I need VTK to build ITK ? ===
No,
With the default configuration, ITK does not require VTK. However, some optional modules (ITKVTKGlue) do require VTK.
 
ITK does not require VTK.
 
VTK is only used by specific demo applications in the Insight/Applications directory. These applications will simply not be build if VTK is not available in your system.


ITK does not provide any visualization functionalities. Applications requiring visualization should implement those functionalities from internal code or libraries like OpenGL, GLUT or VTK.
ITK does not provide any visualization functionalities. Applications requiring visualization should implement those functionalities from internal code or libraries like OpenGL, GLUT or VTK.
In order to use ITK with VTK you must build VTK from sources and make sure that it is configured with the flag USE_ANSI_STDLIB enabled.
Then you have to reconfigure ITK making sure that the option USE_VTK is enabled.
=== Do I need GLUT/OpenGL to build ITK ===
No,
ITK does not depend on GLUT not OpenGL.
GLUT and OpenGL are only used by specific demo applications in the Insight/Applications directory.
ITK does not provide any visualization functionalities. Applications requiring visualization should obtain these services from external libraries like OpenGL, GLUT or VTK.
=== Do I need Tcl to build ITK ===
No,
ITK does not depend on Tcl.
However, there are three ways in which ITK is related to Tcl:
# The testing system used by ITK dashboard is managed by Dart which is writen mostly in Tcl. If you want to configure experimental, continuous or nightly builds in your system using Dart. You will need Tcl installed.
# ITK can be wrapped in order to be used from Tcl.<br />This is done using "Cable". That gives ITK the versatility needed for developing rapid prototyping, and facilitating interactive teaching and experimentaion with ITK classes.
# Some demo applications in the Insight/Applications directory have configured their visualization by using VTK. These demo-applications have packaged ITK filters inside VTK filters and then wrapped those into Tcl using the traditional Tcl wrapping mechanism of VTK.
=== What version of FLTK is required by ITK demo applications ===
The recommended version of fltk is 1.1.3.
The sources can be obtained from ftp.fltk.org or from the "Related Software" page in www.itk.org.
FLTK is in continuous development and it has been quite difficult to keep track of its configuration changes.
Also note that InsightApplications is not any more part of the core Insight Toolkit but is a standalone package.
=== What additional packages are required by each demo-application ===
The following list rapidly summarizes the additional pacakges required by demo applications in the Insight/Applications directory.
The following applications require VTK wrapped for Tcl. These applications insert ITK filters into VTK objects and then wrapp them to be used from Tcl.
* MRIRegistration
* SegmentationEditor
* vtkITK
This wrapping is done with the traditional VTK wrapping mechanism which is totally independdent of ITK mechanism based on Cable.
FLTK is used in the following demo applications to implement their GUI. The recommended version can be downloaded from http://www.itk.org/HTML/DownloadRelatedSoftware.htm
* DistanceMapFilter
* DicomImageViewer
* GaussianFilter
* GradientRecursiveGaussianFilter
* Curves2DExtractor
* Morphogenesis
* MutualInformationEuler2DRegistration
* ImageRegistration
* ImageRegistration2D
* RawImageReaderViewer
* RegionGrowingSegmentation
* ThresholdSegmentationLevelSet
* FastMarchingLevelSet
* ShapeDetectionLevelSet
* MetaImageViewer
* MetaImageColorViewer
* SurfaceGenerator
Among the applications using FLTK for GUI, the following applications also require VTK for visualizing segmented images in 3D:
* RegionGrowingSegmentation
* ThresholdSegmentationLevelSet
* FastMarchingLevelSet
* ShapeDetectionLevelSet
There is also an example of how to use Qt for GUI along with ITK:
* QtITK


=== What 3D file formats can ITK import and export? ===
=== What 3D file formats can ITK import and export? ===


The following table identifies the file formats that ITK can read/write via a factory mechanism based on the file extension (itk::ImageIOFactory). Some proprietary files format are only imported
The following table identifies the file formats that ITK can read/write via a factory mechanism based on the file extension (itk::ImageIOFactory). Some proprietary files format are only imported.  More information on [[ITK File Formats]] is available, including data types supported.


A very nice tool for viewing all of these images is ImageViewer which can be found in the InsightApplication package (fltk is required).
A very nice tool for viewing all of these images is ImageViewer which can be found in the ITKApps repository.


{| border="1"
{| border="1" cellpadding="2" cellspacing="0"
|- bgcolor="#abcdef"
|- bgcolor="#abcdef"
! File Format
! File Format
Line 109: Line 20:
| Analyze 7.5 || AnalyzeImageIO ||
| Analyze 7.5 || AnalyzeImageIO ||
|-
|-
| Dicom || || DicomImageIO
| BMP  &dagger; || BMPImageIO ||
|-
| DICOM || GDCMImageIO || Using DicomImageIO is backward compatible, but user should prefer GDCMImageIO
|-
|-
| GE 4x || || GE4ImageIO
| GE 4x || || GE4ImageIO
Line 121: Line 34:
| IPLCommon || || IPLCommonImageIO
| IPLCommon || || IPLCommonImageIO
|-
|-
| JPEG || JPEGImageIO ||
| JPEG &dagger; || JPEGImageIO ||
|-
| NRRD (.nhdr/.nrrd) || NrrdImageIO ||
|-
| Nifti (.nii) || NiftiImageIO ||
|-
|-
| MetaImage (.mha/.mhd) || MetaImageIO ||
| MetaImage (.mha/.mhd) || MetaImageIO ||
Line 138: Line 55:
|}
|}


&dagger; PNG is not a very good format. At this point it only supports 2D images and only pixel types unsigned char, and unsigned short. The great advantage of PNG is that you can view it with almost any image viewer.
&dagger; BMP, PNG and JPEG are not very good formats for 3D medical images. They only support 2D images and a limited set of pixel types such as unsigned char, and unsigned short. The great advantage of BMP, PNG and JPEG is that you can view them with almost any image viewer. It is possible to read/write 3D datasets as collections of 2D slices each one in an independent BMP, PNG or JPEG file by using the ImageSerierReader and ImageSeriesWriter.
 
&Dagger; This is higly recommended not using this format. RAW is not a format, it is insufficient, inconsistent and simply dangerous. A RAW file without a header is useless, and once you add a header, it is not RAW anymore.


=== What if my file format is not supported by ITK ? ===
&Dagger; It is higly recommended not using this format. RAW is not a format, it is insufficient, inconsistent and simply dangerous. A RAW file without a header is useless, and once you add a header, it is not RAW anymore.
If ITK doesn't have a specific file format reader at this point.


You may try converting this specific file format image to a format like PNG, for which ITK has readers.
=== What if my file format is not supported by ITK? ===
If ITK doesn't have a specific file format reader at this point, you may try converting this specific file format image to a format like PNG, for which ITK has readers.


A good set of tools for performing such conversions is available in ImageMagick. It can be downloaded it for free from: http://www.imagemagick.org/
A good set of tools for performing such conversions is available in ImageMagick. It can be downloaded it for free from: http://www.imagemagick.org/
Line 151: Line 66:
You can also take advantage of the VTK readers/importers. All you need is then use the VTKImageToImage adaptor in order to convert the vtkImageData into an itk::Image.
You can also take advantage of the VTK readers/importers. All you need is then use the VTKImageToImage adaptor in order to convert the vtkImageData into an itk::Image.


Supported VTK file formats can be found here: [[Itk_FAQ#What_3D_file_formats_can_ITK_import_and_export]] and http://public.kitware.com/cgi-bin/vtkfaq?req=show&file=faq03.011.htp
Supported VTK file formats can be found here: [[VTK_FAQ#What_image_file_formats_can_VTK_read_and_write.3F|What image file formats can VTK read and write?]] and [[VTK_FAQ#What_3D_file_formats_can_VTK_import_and_export.3F|What 3D file formats can VTK import and export]]
 
=== How do I read a volume from a DICOM series? ===
The following are alternative options for reading DICOM series. The first one in the list is the recommended option. The others are provided in case of desperation.


=== How to read a volume from a DICOM series ===
# Use the itk::ImageSeriesReader<> in combination with the DicomSeriesFileNames<>. For a full example on how to do this, please look at the source code under Insight/Code/Examples/IO/DicomSeriesReadImageWrite.cxx.
# Write a MetaImageHeader<br>This is a small text file holding information about the image: spacing, dimensions, pixelt type... This header can hold the list of dicom files you want to read. The only restriction is that the files must be uncompressed.<br>The easy way to create a MetaImage header is to use the application: MetaImageImporter that is available in: InsightApplications/MetaImageImporter. you can also take an existing metaimage reader and modify it in order to fit your needs. Please find attached one file that you can edit it with your favorite text editor.
# Write a MetaImageHeader<br>This is a small text file holding information about the image: spacing, dimensions, pixelt type... This header can hold the list of dicom files you want to read. The only restriction is that the files must be uncompressed.<br>The easy way to create a MetaImage header is to use the application: MetaImageImporter that is available in: InsightApplications/MetaImageImporter. you can also take an existing metaimage reader and modify it in order to fit your needs. Please find attached one file that you can edit it with your favorite text editor.
# Use MRIConvert<br>Jolinda Smith from the Lewis Center for Neuroimaging at the University of Oregon has developed a nice application that allows you to load DICOM series and export them in MetaImage and Analyze format (among others).<br>She graciously has made this application publicly available at: http://lcni.uoregon.edu/~jolinda/MRIConvert There is a fresh version updated in april 14th.
# Use MRIConvert<br>Jolinda Smith from the Lewis Center for Neuroimaging at the University of Oregon has developed a nice application that allows you to load DICOM series and export them in MetaImage and Analyze format (among others).<br>She graciously has made this application publicly available at: http://lcni.uoregon.edu/~jolinda/MRIConvert There is a fresh version updated in april 14th.
# Jeff Brubaker and Stephen R. Aylward, at the UNC<br>CADDLab developed a DICOM query/move application called "MIND" (whit the motto: "MIND is not DICOM"). This application loads DICOM files over the network and export them in MetaImage format. This application is open source and it is available at: http://www.jeffro.net/mind/ and http://caddlab.rad.unc.edu/software/MIND/
# Jeff Brubaker and Stephen R. Aylward, at the UNC<br>CADDLab developed a DICOM query/move application called "MIND" (whit the motto: "MIND is not DICOM"). This application loads DICOM files over the network and export them in MetaImage format. This application is open source and it is available at: http://www.jeffro.net/mind/ and http://caddlab.rad.unc.edu/software/MIND/


=== Interpreted languages supported by ITK ===
=== How do I write a volume as DICOM series? ===
Use ITK in combination with gdcm
 
http://gdcm.sourceforge.net/
 
GDCM is an open source package developed by the Creatis team at INSA-Lyon. It is distributed under a license similar to ITK.
 
http://gdcm.sourceforge.net/Copyright.html
 
GCDM uses CMake in order to configure its build process, so you will find a familiar setup. Once you download, configure and buid GDCM, you can reconfigure ITK by running CMake in your ITK build, going into the Advanced options and enabling USE_GDCM. 
 
For a code example on how to use GDCM for reading and writing DICOM series, please refer to the source code in
 
Insight/Examples/IO/DicomSeriesReadImageWrite2.cxx
 
You can always use the latest and greatest of GDCM, simply use an installed version of GDCM and link ITK to it using ITK_USE_SYSTEM_GDCM
 
=== Which interpreted languages are supported by ITK? ===
Currently ITK supports the following language bindings:
Currently ITK supports the following language bindings:


* Tcl
* Python  
* Python  
* Java
* Java
Java was added in February 2004, it will not be found in the ITK release 1.6. You will need a CVS checkout with a data posterior to February 25 2004.


=== How do I cite the use of ITK in a publication? ===
=== How do I cite the use of ITK in a publication? ===
The Insight software may be cited by referencing the paper, the books, and/or the web site.
The Insight software may be cited by referencing the paper, the books, and/or the web site.


A) The paper:
A) '''The papers'''


T.S. Yoo, M. J. Ackerman, W. E. Lorensen, W. Schroeder, V. Chalana, S. Aylward, D. Metaxes, R. Whitaker. Engineering and Algorithm Design for an Image Processing API: A Technical Report on ITK - The Insight Toolkit. In Proc. of Medicine Meets Virtual Reality, J. Westwood, ed., IOS Press Amsterdam pp 586-592 (2002).
McCormick M, Liu X, Jomier J, Marion C, Ibanez L. ITK: enabling reproducible research and open science. Front Neuroinform. 2014;8:13. Published 2014 Feb 20. doi:10.3389/fninf.2014.00013


B) The books:
T.S. Yoo, M. J. Ackerman, W. E. Lorensen, W. Schroeder, V. Chalana, S. Aylward, D. Metaxas, R. Whitaker. Engineering and Algorithm Design for an Image Processing API: A Technical Report on ITK - The Insight Toolkit. In Proc. of Medicine Meets Virtual Reality, J. Westwood, ed., IOS Press Amsterdam pp 586-592 (2002).
 
B) '''The books'''
 
"The ITK Software Guide: Design and Functionality"
  Fourth Edition
  Johnson, McCormick, Ibanez.
  published by Kitware Inc.
  2015
  ISBN: 9781-930934-28-3
 
"The ITK Software Guide: Introduction and Development Guidelines"
  Fourth Edition
  Johnson, McCormick, Ibanez.
  published by Kitware Inc.
  2015
  ISBN: 9781-930934-27-6


  "Insight into Images"
  "Insight into Images"
Line 182: Line 130:


  "The ITK Software Guide"
  "The ITK Software Guide"
  Second Edition
  Ibanez, Schroeder, Ng, Cates.
  published by Kitware Inc.
  2005
  ISBN: 1-930934-15-7
"The ITK Software Guide"
  First Edition
   Ibanez, Schroeder, Ng, Cates.
   Ibanez, Schroeder, Ng, Cates.
   published by Kitware Inc.
   published by Kitware Inc.
  2003
   ISBN: 1-930934-10-6
   ISBN: 1-930934-10-6


Line 192: Line 149:
   ISBN:  1-930934-09-2
   ISBN:  1-930934-09-2


C) The Web sites:
'''BibTtex citations'''


"The Insight Segmentation and Registration Toolkit"
  @Manual{johnson2015itk,
  www.itk.org
    author = {Johnson, Hans J and McCormick, Matthew M and Ibanez, Luis},
    publisher = {Kitware, Inc.},
    title = {{The ITK Software Guide Book 1: Introduction and Development Guidelines-Volume 1}},
    year = {2015}
    }


"CMake: Cross Platform Make"
  @Manual{johnson2015itk,
   www.cmake.org
    author = {Johnson, Hans J and McCormick, Matthew M and Ibanez, Luis},
    publisher = {Kitware, Inc.},
    title = {{The ITK Software Guide Book 2: Design and Functionality-Volume 2}},
    year = {2015}
   }


If you want to include ITK in an acknowledment section, a phrase similar to the following may be used:
  @Manual{ITKSoftwareGuide,
    Title          = {The {ITK} {S}oftware {G}uide},
    Author        = {Ibanez, L. and Schroeder, W. and Ng, L. and Cates, J.},
    Organization  = "Kitware, Inc.",
    Edition        = {First},
    year          = {2003},
    note          = {ISBN 1-930934-10-6},
    url            = \href{[http://www.itk.org/ItkSoftwareGuide.pdf http://www.itk.org/ItkSoftwareGuide.pdf]}{<nowiki>http://www.itk.org/ItkSoftwareGuide.pdf</nowiki>},
    }
 
  @Manual{ITKSoftwareGuideSecondEdition,
    Title          = {The {ITK} {S}oftware {G}uide},
    Author        = {Ibanez, L. and Schroeder, W. and Ng, L. and Cates, J.},
    Organization  = "Kitware, Inc.",
    Edition        = {Second},
    year          = {2005},
    note          = {ISBN 1-930934-15-7},
    url            = \href{[http://www.itk.org/ItkSoftwareGuide.pdf http://www.itk.org/ItkSoftwareGuide.pdf]}{<nowiki>http://www.itk.org/ItkSoftwareGuide.pdf</nowiki>},
    }
 
  @Manual{ITKSoftwareGuideThirdEdition,
    Title          = {The {ITK} {S}oftware {G}uide},
    Author        = {Johnson, Hans J. and McCormick, M. and Ib\'{a}{\~n}ez, L. and The Insight Software Consortium},
    Organization  = "Kitware, Inc.",
    Edition        = {Third},
    year          = {2013},
    note          = {\textit{''In press''}},
    url            = \href{[http://www.itk.org/ItkSoftwareGuide.pdf http://www.itk.org/ItkSoftwareGuide.pdf]}{<nowiki>http://www.itk.org/ItkSoftwareGuide.pdf</nowiki>},
    }
 
C) '''A specific software version'''
 
See:
 
  https://zenodo.org/record/3592082
 
If you have a publication that used ITK, please create a pull request to add it to ITKBibliography.bib:
 
  https://github.com/InsightSoftwareConsortium/insightsoftwareconsortium.org/blob/insightsoftwareconsortium-org/citations/ITKBibliography.bib
 
If you want to include ITK in an acknowledgment section, a phrase similar to the following may be used:


  "This work benefited from the use of the Insight Segmentation
  "This work benefited from the use of the Insight Segmentation
Line 215: Line 220:
   open source system and it is freely available at www.cmake.org."
   open source system and it is freely available at www.cmake.org."


=== I got the message: "Could not create IO object for file" ===
=== Is ITK FDA-Approved? ===
Question:


When trying to read or write a file using the ImageFileReader or the ImageFileWriter I got an exception with the following message:
Given the fact that ITK is a software toolkit, it cannot be the
subject of FDA approval as a medical device. We have discussed
this topic in several occasions and received advice from FDA
representatives, that can be summarized as follow:


itk::ImageFileReaderException (00F7F494)
Location: "Unknown"
File: C:\ITK\InsightToolkit-1.6.0\Code\IO\itkImageFileReader.txx
Line: 101
Description: Could not create IO object for file c:\t1.mnc


What is going wrong ?
  ITK is to be considered as an off-the-shelf (OTS) product that
  is used for supporting a higher level medical application/product.
  The developer of such application/product will be responsible for
  performing the validation processes described in FDA published
  guidelines for the development of software-related medical devices.


Answer:
For mode details see the page [[FDA Guidelines for Software Developement]]
 
This exception is thrown when ITK does not recognize the fileformat that you are trying to read or write. When reading, ITK recognize file formats by asking a set of internal readers to attempt to read your file. If none of the registered readers accept your file, then the exception above is thrown. When writing, ITK uses the extension of the filename in order to chose the fileformat to be used. You must make sure that you use one of the filename extensions recognized by ITK. Please look at FAQ entry 1.7 for a full list of those extensions and associated fileformats.
 
Additional details on the ITK Input/Output architecture are available in the ITK Software Guide: http://www.itk.org/ItkSoftwareGuide.pdf.


== Language bindings ==
== Language bindings ==
=== Error opening hint file NOTFOUND ===
=== What does "Error opening hint file NOTFOUND" mean? ===
When you enable "USE_VTK" in the CMake configuration of ITK, and VTK was built with wrapping, CMake looks for a "hints" file.
When you enable "USE_VTK" in the CMake configuration of ITK, and VTK was built with wrapping, CMake looks for a "hints" file.


Line 247: Line 249:
  VTK_WRAP_HINTS:FILEPATH=/home/johndoe/src/VTK/Wrapping/hints
  VTK_WRAP_HINTS:FILEPATH=/home/johndoe/src/VTK/Wrapping/hints


== Using Insight ==
=== How do I use ITK with WrapITK? ===
=== Compile/Link errors involving C++ streams library ===


Compile and link errors involving the C++ streams library (ostream, istream, ifstream, ofstream, etc.) are usually the result of collisions between the old and new streams library. The C++ streams library in the Standard Library is different and usually imcompatible with the original C++ streams library. The new streams library is share the same class names as the old streams library but has a very different implementation (templates, thread safety, etc.). ITK can only be built using the Standard Library streams library.
WrapITK allows you to use ITK from other languages.
(Python, Java, Ruby, ...)


If the compile/link error is in an ITK file, the solution is usually to include the proper stream header file, i.e. <fstream> before any other include file. The forces the streams library used by all subsequent headers to be the Standard Library version.
* [[ITK/Wrapping | See the page about ITK wrappings]]


If the compile/link error is in an application that is trying to use ITK, the solution is usually to include an ITK header file before any other include file. This forces whatever include files that the application may use to use the Standard Library streams library.
=== How do I use ITK from C# .NET? ===


=== What is the difference between the CMake options ITK_WRAP_TCL and VTKITK_WRAP_TCL ? ===
There are currently three options:
# Use [http://code.google.com/p/manageditk ManagedITK]
#* '''NOTE: This option is not recommended as the project is no longer supported'''
# Use the [http://www.simpleitk.org/ SimpleITK] [http://sourceforge.net/projects/simpleitk/files/SimpleITK C# language bindings]
#* SimpleITK is great, but it does not support all filters (e.g. no support for registration in version 0.5.1)
#* A list of available filters can be found [http://www.itk.org/SimpleITKDoxygen/html/Filter_Coverage.html here] (valid Sept 2012)
# Manually wrap the desired functionality
#* This option requires the most work, but is the most flexible, allowing you to use any ITK functionality you desire
#* An example can be found [[ITK/Using ITK from .NET|here]]


ITK_WRAP_TCL enables the official method of wrapping ITK into Tcl. This wrapping requires the installation of two external packages: Cable and GCC_XML. Information about these packages can be found at http://public.kitware.com/Cable/HTML/Index.html and http://www.gccxml.org/HTML/Index.html
NOTE: WrapITK does not currently support C# language bindings, but could be made to do so.


VTKITK_WRAP_TCL is not really part of ITK. It is only required to enable the build of some demo-applications in the Insight/Applications directory. These applications use VTK for visualization. ITK filter are packaged here inside VTK classes that are subsequently wrapped for Tcl using the traditional VTK wrapping mechanism (not Cable).
== Using the Insight Toolkit ==


=== EMACS configuration file : ITK coding style ===
=== How do I combine ITK and VTK in my application? ===
 
A full tutorial on how to combine ITK and VTK is available at
 
"Getting Started with ITK and VTK"
http://www.itk.org/CourseWare/Training/GettingStarted-II.pdf
 
You will need the auxiliary classes available at
 
  ITKApps
 
For example, for converting ITK images into VTK images and back, you will find useful the files from the ITKVTKGlue module:
 
      itkImageToVTKImageFilter.h
      itkImageToVTKImageFilter.hxx
      itkVTKImageToImageFilter.h
      itkVTKImageToImageFilter.hxx
 
=== How do I configure Emacs for ITK coding style? ===
You can add the following codes into your .emacs file
You can add the following codes into your .emacs file


  ;;;;;;;;;;;;;;
  ;;;;;;;;;;;;;;
  (c-add-style "itk"
  (c-add-style "itk"
             '("stroustrup"  
             '("stroustrup"  
               (c-basic-offset . 2)
               (c-basic-offset . 2)
Line 277: Line 303:
                 (substatement-open . +)
                 (substatement-open . +)
                 (statement-block-intro . 0) ) ) )
                 (statement-block-intro . 0) ) ) )
  (add-hook 'c++-mode-hook (function (lambda ()
  (add-hook 'c++-mode-hook (function (lambda ()
   (c-set-style "itk")(turn-on-auto-fill))))
   (c-set-style "itk")(turn-on-auto-fill))))
  (add-to-list 'auto-mode-alist '("\\.txx\\'" . c++-mode)) (add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
  (add-to-list 'auto-mode-alist '("\\.txx\\'" . c++-mode)) (add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
  ;;;;;;;;;;;
  ;;;;;;;;;;;


== VIM configuration file : ITK coding style ==
=== How do I configure VIM for ITK coding style? ===
for all of you who use VIM, here are just couple of things:


  set tabstop=2 " Tabs are two characters
  set tabstop=2 " Tabs are two characters
Line 294: Line 316:
  set cinoptions={1s,:0,l1,g0,c0,(0,(s,m1 " ITK/VTK style indenting
  set cinoptions={1s,:0,l1,g0,c0,(0,(s,m1 " ITK/VTK style indenting


Then you can also use CMake indentation and syntax file which are available on www.vim.org.
You can also use CMake indentation and syntax file which are available on www.vim.org.


This was contributed by Andy Cedilnik @kitware.com
This was contributed by Andy Cedilnik @kitware.com


=== FLTK_WRAP_UI called with FLTK_WARP_UI undefined ===
If you'd like to enable c++ style syntax highlight for *.txx files, put the following lines in your .vimrc file:
I use CMake to build the InsightApplications and the following error appears:
syntax on
au BufNewFile,BufRead *.txx set filetype=cpp


CMake Error: Error in cmake code at
../../CMakeLists.txt:20:
FLTK_WRAP_UI called with FLTK_WARP_UI undefined


I wonder where and how to define it.
=== What is the "ITK_TEMPLATE_VISIBILITY_DEFAULT" CMake option? ===


This error message
== Platform-specific questions ==
=== How do I avoid multiple prompts to reload all projects in Microsoft Visual Studio? ===
When the CMake source changes, you may see multiple prompts to reload many projects.


"...FLTK_WARP_UI undefined"
DO NOT USE "Rebuild All" or "Batch Build". Use the following recommended procedure.
 
There is an ALL_BUILD target available in the MSVC++ workspace. The best way to build ITK is to set ALL_BUILD as the active project, then select the active configuration you want (DEBUG, etc).
 
This can also be done from the command line like this: msdev ITK.dsw /MAKE "ALL_BUILD - Debug" /REBUILD
 
== Contribute ==
=== How do I make code contributions to ITK? ===
Please see this page: [[ITKContribute]].
 
== Testing ==
=== Is ITK tested? ===
Please see this page: [[ITK/Testing]]
 
== Working with Image Data ==
 
===How do I iterate through all the pixels in an image?===
 
Please see this example: http://www.itk.org/Wiki/ITK/Examples/Iterators/ImageRegionIterator of itkImageRegionIterator.
 
===What are Hounsfield Units?===
 
Hounsfield units were defined by Sir Godfrey N. Hounsfield, on of the pioneers of Computer Tomography for clinical applications.
 
The units represent the linear attenuation of X-Rays for a particular material.
 
The units scale is defined in such a way that level for Water is 0 and the level for Air is -1000.
 
The attenuation of any other material is mapped linearly into this range.


appears when you have missed to specify some of the FTLK components.
A table of Hounsfield units for common human tissues is avalable in the following link [[ITK Hounsfield Units]]


Please run Cmake again, pass to "Advanced" mode and double check that you provided the right paths for the following components
===What are MRI T1 / T2 Units?===


* FLTK_BASE_LIBRARY
MRI images measure two types of relaxation times.
* FLTK_FLUID_EXECUTABLE
* FLTK_FORMS_LIBRARY
* FLTK_GL_LIBRARY
* FLTK_INCLUDE_DIR


Here is for example how they look in a typical Windows installation:
The units are millisecons and the two relaxation concepts relate to how long it takes for the molecules in the tissue to realign themselves with a magentic field after being perturbed.


FLTK_BASE_LIBRARY:FILEPATH=E:/cygwin/home/ibanez/src/fltk-1.1.3/lib/fltkd.lib
Details on the MRI units are available in the Wikipedia:
FLTK_FLUID_EXECUTABLE:FILEPATH=E:/cygwin/home/ibanez/src/fltk-1.1.3/fluid/fluidd.exe
FLTK_FORMS_LIBRARY:FILEPATH=E:/cygwin/home/ibanez/src/fltk-1.1.3/lib/fltkformsd.lib
FLTK_GL_LIBRARY:FILEPATH=E:/cygwin/home/ibanez/src/fltk-1.1.3/lib/fltkgld.lib
FLTK_IMAGES_LIBRARY:FILEPATH=E:/cygwin/home/ibanez/src/fltk-1.1.3/lib/fltkimagesd.lib
FLTK_INCLUDE_DIR:PATH=E:/cygwin/home/ibanez/src/fltk-1.1.3


== Platform-specific questions ==
[http://en.wikipedia.org/wiki/Relaxation_%28NMR%29 Relaxation (NMR)]
=== Build->Rebuild All in MS VC++ reloads all projects ===
When performing a "Rebuild All" from Microsoft Visual C++, every project prompts the user for a reload (and their are hundreds of projects).


DO NOT USE "Rebuild All" or "Batch Build". Use the following recommended procedure.
=== DICOM: Bits Allocated, Bits Stored and High Bit ===


There is an ALL_BUILD target available in the MSVC++ workspace. The best way to build ITK is to set ALL_BUILD as the active project, then select the active configuration you want (DEBUG, etc).
A question that is often asked on insight-users is :
I am trying to read/write a DICOM image, but some of the DICOM fields have changed after I write it back on disk.


This can also be done from the command line like this: msdev ITK.dsw /MAKE "ALL_BUILD - Debug" /REBUILD
Here is what you have on disk:
<pre>
        Bits Allocated = 16
        Bits Stored    = 12
        High Bit      = 11


=== Borland 5.5 Compiler Issues ===
                          |<------------------ pixel ----------------->|
To build Insight using the (free) Borland 5.5 compiler:
            ______________ ______________ ______________ ______________
          |XXXXXXXXXXXXXX|              |              |              |
          |______________|______________|______________|______________|
            15          12 11          8 7            4 3            0
</pre>


# Get the Borland compiler from http://www.borland.com and install it
Here is what you generally get after writing by GDCM:
# Run cmakesetup and select the Borland Makefiles in the "Build For:" drop down.
<pre>
# Set the CMAKE_BUIlD_TYPE to MinSizeRel. This is required so that the Borland linker will stay below its size limit which is arounbd 35 meg for a tds file.
        Bits Allocated = 16
        Bits Stored    = 16
        High Bit      = 15


=== Windows + FLTK: unresolved external symbol TrackMouseEvent ===
            |<------------------------- pixel ------------------------>|
This error is due to changes in FLTK and it is totally unrelated to ITK. The error only appears in ITK demo applications that are using FLTK for GUI.
            ______________ ______________ ______________ ______________
          |              |              |              |              |
          |______________|______________|______________|______________|
            15          12 11          8 7            4 3            0
</pre>


The library "comctl32" must be added to the link command line.
Since DICOM V3, you '''cannot''' store any overlay in the unused bits of the Pixel Data (0x7fe0,0x0010), thus it imply that the unused bits are '''zeros'''.
In ITK, there is no such thing as 12bits Pixel Type, thus when instanciating your reader you declare a 16bits Pixel Type. This buffer is then passed back to GDCM which sees an array of 16bits values and then simply used the simpliest way to store this buffer back on disk: Bits Stored = 16 and High Bit = 15.
In case you have not made any change to your pixel buffer, implicitely the first 4 bits will be zero again. The only difference being that they are not as clearly declared as 12bits.


You can solve this by editing the CMake file: CMake/Modules/FindFLTK.cmake and around line 39 add the comctl32 library.
=== I'm working with DICOM images, where can I find more information? ===
[[ITK/DICOM]]


After the change the lines should look like:
== Data Display ==


IF(WIN32)
===What imaging software is available for displaying medical image files?===
  SET( FLTK_PLATFORM_DEPENDENT_LIBS wsock32 comctl32 )
ENDIF(WIN32)


This is already fixed in the CVS version of CMake FindFLTK.cmake.
Please see the [[ITK/Third_Party_Applications | third party applications]] page for visualization applications that used ITK to perform Image reading/writing.


The CMake version 1.6 will have this issue solved.
===When I view the output of my program, all I see is a black image. What went wrong?===


== Testing ==
ITK is capable of reading and writing data in a variety of formats and bit depths. However many 'consumer' image programs only work with 8-bit data, so when you try to display a 16-bit data file the image will appear black. The solution is to use an image display program that correctly handles these types of files. A small selection is listed above.
=== Is ITK tested regularly? ===
ITK is tested throughout the day on machines distributed around the world. You can view the results at: http://public.kitware.com/Insight/Testing/HTML/TestingResults/Dashboard/MostRecentResults-Nightly/Dashboard.html


ITK uses Dart to perform builds, run tests and generate dashboards. You can find more information about Dart at http://www.itk.org/Dart/
[http://www.imagemagick.org/ ImageMagick] is a particularly useful set of tools for image display, manipulation and conversion.


=== What is the testing schedule? ===
The `ImageViewer` program, part of InsightApplications, is capable of correctly loading and displaying all file types supported by ITK (including anisotropic images).
Dart opens a daily dashboard at 1:00AM Eastern Daylight Time and keeps that dashbooard open for 24 hours. Build/Test results submitted as "nightlies" will appear on the currently opened dashboard. Each test site can select a convenient time to run tests.


Fresh dashboards are generated every hour, on the hour. They can also be generated on demand using the Rollup button on the dashboard. This button should be used sparingly since dashboard rollups can be time consuming.
(Gavin Baker, 24-Jun-2004)


In addition to nightly testing, several sites run Continuous build/tests. These sites monitor cvs repository activity and begin a build/test sequence if there are updates to the repository. If a compile error is detected, the Dashboard server sends email to the "offending" party.
== Registration ==


=== What kind of testing is performed? ===
===Can ITK be used for multi-modal registration? For example, CT-MRI, or MRI-fMRI?===
ITK has three types of tests:


# Unit Tests. Also called white box tests. These tests reside in the Testing/Code/XXX directories. There are meant to exercise a class's methods and verify that the code compiles, links and produces expected results. These tests do not need to produce results that are useful to a user. If a test returns a 0 status, it passes. A test fails if it returns a non-zero status.
ITK provides several method for performing Multi-Modality registration. These methods are described in detail in the SoftwareGuide Chapter 8, pdf-page 241 to 340. In particular you will find interesting Section 8.4 in pdf-page 255 where the Mutual Information metrics are described.
# Blackbox Tests. These tests are automatically (or semi-automatically) generated. For example, each Code directory has a test called itkXXXHeaderTest. This test is automatically created and has a "#include" for each file in the directory.
# Regression Tests. These tests generate results and compare them with a known result. The purpose of regression testing is to detect changes in the output of the system.  


=== How Do I Add a Test? ===
Examples on multimodality registration are available in `Insight/Examples/Registration`.  A demo application using Mutual Information is available under `InsightApplications/LandmarkInitializedMutualInformationRegistration`.


=== What is a continuous build and how can I contribute one? ===
It is strongly recommended that you read the chapter on image resampling (Section 6.9.4 of the pdf) before you get involved with image registration methods. That will save you a lot of misunderstandings that are common in new users.
Continuous builds run throughout the day and report their output in the Continuous Builds portion of the dashboard. The most recent build is at the top of the list. The builds run periodically and check the status of the repository. If a file is added or changed since the last build, the working repository of the continuous build is updated, the code compiled and tests executed. Optional e-mail norifications can be sent if there are errors, warmings or test failures.


You can set up a continuous build. This entails writing some small shell scripts and setting up a scheduler (Scheduler for Windows, cron for Linux/Unix). You will also need to install tcl, checkout Dart and configure your build for testing.
You will also find useful the tutorial sessions, in particular [http://www.itk.org/CourseWare/Training/RegistrationMethodsOverview.pdf the overview].


For Windows 2000, here are three batch files that can be modified for your own environment.
(Luis Ibanez, 7-June-2004)


AllowInsightContinuous.bat
== Common Problems ==
BuildInsightContinuous.bat
PreventInsightContinuous.bat


The batch files use a lock to prevent/allow the continuous
<!--This fragment identifier is referenced from exception messages in the ITK Reader and Writer-->
<div id="NoFactoryException"></div>


rem ************* AllowInsightContinuous.bat
=== Why can't I read any image files? or Why am I getting the exception message: "There are no registered IO factories."? ===
rem Allow the Continuous to run
rem
c:
cd c:\lorensen\InsightContinuous\Insight-VC6
if EXIST continuous.lock (
  del continuous.lock
)
cd ..


rem ************* BuildInsightContinuous.bat
When trying to read or write a file using the ImageFileReader or the ImageFileWriter I got an exception with the following message:
rem DO a C++ Build Continuously
rem
c:
rem Setup proxy it behind a firewall
set HTTP_PROXY=webcache
set HTTP_PROXY_PORT=8080


  rem
  itk::ImageFileReaderException (00F7F494)
  rem Setup the path
  Location: "Unknown"
  rem
  File: C:\ITK\InsightToolkit-1.6.0\Code\IO\itkImageFileReader.hxx
  set PATH=c:/lorensen/InsightContinuous/Insight-VC6/bin/Release;%PATH%
  Line: 101
Description: Could not create IO object for file c:\t1.mnc


rem
This exception is thrown when ITK does not recognize the fileformat that you are trying to read or write. When reading, ITK recognize file formats by asking a set of internal readers to attempt to read your file. If none of the registered readers accept your file, then the exception above is thrown. When writing, ITK uses the extension of the filename in order to chose the fileformat to be used. Make sure that you use one of the filename extensions recognized by ITK, and that the ImageIO class for that format has been registered.
rem Tell cvs where .cvspass resides
set HOME=c:/lorensen
cd c:\lorensen\InsightContinuous\Insight-VC6
if EXIST continuous.lock (
  exit /B
) else (
  date /T > continuous.lock
  time /T >> continuous.lock
  cd c:\lorensen\InsightContinuous\Insight-VC6
  tclsh83 c:/lorensen/Dart/Source/Client/DashboardManager.tcl DartConfiguration.tcl Continuous Start Update Configure Build Test Submit


  cd c:\lorensen\InsightContinuous\Insight-VC6
Enable all the IO modules that you wish to support in your ITK CMake configuration.
  del continuous.lock
  cd ..


)
To register the IO factory:


rem ***************** PreventInsightContinuous.bat
* If you are using CMake: call ''include( ${ITK_USE_FILE} )'' before ''add_executable'' or ''add_library''.
rem Prevent the Continuous
rem
c:


cd c:\lorensen\InsightContinuous\Insight-VC6
* If you are not using CMake: the factories should be registered with ''itk::XXXImageIOFactory::RegisterOneFactory()'' where ''XXX'' is the format.
if EXIST continuous.lock (
  exit /B
) else (
  echo "Prevent continuous for nightly" > continuous.lock
)
cd ..


Now you need to establish a schedule for the three batch jobs. Use the "Scheduled Tasks" on the "Control Panel" to access the Schedule Task Wizard. The following schedule runs the continuous every 10 minutes from 6:05AM until 12:00AM. The Allow and Prevent scripts turn the build ON/OFF at the appropriate time. Schedule each batch file as follows:
* You may need to add something to the REQUIRED list of the FIND_PACKAGE call that includes ITK from your project. For example, if you were trying to open a png file when you got this error, ensure your CMakeLists.txt contains FIND_PACKAGE(ITK REQUIRED ITKIOPNG)


AllowInsightContinuous.bat - Daily, Start 6:00AM
{{ITK/Template/Footer}}
BuildInsightContinuous.bat - Daily, Start 6:05AM, Advanced: Repeat Task every 10 minutes, duration 17 hours and 55 minutes
PreventContinuous.bat - Daily, Start 12:00AM

Latest revision as of 21:42, 6 February 2020

General information and availability

Do I need VTK to build ITK ?

With the default configuration, ITK does not require VTK. However, some optional modules (ITKVTKGlue) do require VTK.

ITK does not provide any visualization functionalities. Applications requiring visualization should implement those functionalities from internal code or libraries like OpenGL, GLUT or VTK.

What 3D file formats can ITK import and export?

The following table identifies the file formats that ITK can read/write via a factory mechanism based on the file extension (itk::ImageIOFactory). Some proprietary files format are only imported. More information on ITK File Formats is available, including data types supported.

A very nice tool for viewing all of these images is ImageViewer which can be found in the ITKApps repository.

File Format Read/Write Import
Analyze 7.5 AnalyzeImageIO
BMP † BMPImageIO
DICOM GDCMImageIO Using DicomImageIO is backward compatible, but user should prefer GDCMImageIO
GE 4x GE4ImageIO
GE 5x GE5ImageIO
GE Advantage Windows GEAdwImageIO
Gipl (.gipl) GiplImageIO
IPLCommon IPLCommonImageIO
JPEG † JPEGImageIO
NRRD (.nhdr/.nrrd) NrrdImageIO
Nifti (.nii) NiftiImageIO
MetaImage (.mha/.mhd) MetaImageIO
PNG † PNGImageIO
Raw ‡ RawImageIO
Siemens Vision SiemensVisionImageIO
Stimulate (spr/sdt) StimulateImageIO
TIFF TIFFImageIO
VTK Structured Points VTKImageIO

† BMP, PNG and JPEG are not very good formats for 3D medical images. They only support 2D images and a limited set of pixel types such as unsigned char, and unsigned short. The great advantage of BMP, PNG and JPEG is that you can view them with almost any image viewer. It is possible to read/write 3D datasets as collections of 2D slices each one in an independent BMP, PNG or JPEG file by using the ImageSerierReader and ImageSeriesWriter.

‡ It is higly recommended not using this format. RAW is not a format, it is insufficient, inconsistent and simply dangerous. A RAW file without a header is useless, and once you add a header, it is not RAW anymore.

What if my file format is not supported by ITK?

If ITK doesn't have a specific file format reader at this point, you may try converting this specific file format image to a format like PNG, for which ITK has readers.

A good set of tools for performing such conversions is available in ImageMagick. It can be downloaded it for free from: http://www.imagemagick.org/

You can also take advantage of the VTK readers/importers. All you need is then use the VTKImageToImage adaptor in order to convert the vtkImageData into an itk::Image.

Supported VTK file formats can be found here: What image file formats can VTK read and write? and What 3D file formats can VTK import and export

How do I read a volume from a DICOM series?

The following are alternative options for reading DICOM series. The first one in the list is the recommended option. The others are provided in case of desperation.

  1. Use the itk::ImageSeriesReader<> in combination with the DicomSeriesFileNames<>. For a full example on how to do this, please look at the source code under Insight/Code/Examples/IO/DicomSeriesReadImageWrite.cxx.
  2. Write a MetaImageHeader
    This is a small text file holding information about the image: spacing, dimensions, pixelt type... This header can hold the list of dicom files you want to read. The only restriction is that the files must be uncompressed.
    The easy way to create a MetaImage header is to use the application: MetaImageImporter that is available in: InsightApplications/MetaImageImporter. you can also take an existing metaimage reader and modify it in order to fit your needs. Please find attached one file that you can edit it with your favorite text editor.
  3. Use MRIConvert
    Jolinda Smith from the Lewis Center for Neuroimaging at the University of Oregon has developed a nice application that allows you to load DICOM series and export them in MetaImage and Analyze format (among others).
    She graciously has made this application publicly available at: http://lcni.uoregon.edu/~jolinda/MRIConvert There is a fresh version updated in april 14th.
  4. Jeff Brubaker and Stephen R. Aylward, at the UNC
    CADDLab developed a DICOM query/move application called "MIND" (whit the motto: "MIND is not DICOM"). This application loads DICOM files over the network and export them in MetaImage format. This application is open source and it is available at: http://www.jeffro.net/mind/ and http://caddlab.rad.unc.edu/software/MIND/

How do I write a volume as DICOM series?

Use ITK in combination with gdcm

http://gdcm.sourceforge.net/

GDCM is an open source package developed by the Creatis team at INSA-Lyon. It is distributed under a license similar to ITK.

http://gdcm.sourceforge.net/Copyright.html

GCDM uses CMake in order to configure its build process, so you will find a familiar setup. Once you download, configure and buid GDCM, you can reconfigure ITK by running CMake in your ITK build, going into the Advanced options and enabling USE_GDCM.

For a code example on how to use GDCM for reading and writing DICOM series, please refer to the source code in

Insight/Examples/IO/DicomSeriesReadImageWrite2.cxx

You can always use the latest and greatest of GDCM, simply use an installed version of GDCM and link ITK to it using ITK_USE_SYSTEM_GDCM

Which interpreted languages are supported by ITK?

Currently ITK supports the following language bindings:

  • Python
  • Java

How do I cite the use of ITK in a publication?

The Insight software may be cited by referencing the paper, the books, and/or the web site.

A) The papers

McCormick M, Liu X, Jomier J, Marion C, Ibanez L. ITK: enabling reproducible research and open science. Front Neuroinform. 2014;8:13. Published 2014 Feb 20. doi:10.3389/fninf.2014.00013

T.S. Yoo, M. J. Ackerman, W. E. Lorensen, W. Schroeder, V. Chalana, S. Aylward, D. Metaxas, R. Whitaker. Engineering and Algorithm Design for an Image Processing API: A Technical Report on ITK - The Insight Toolkit. In Proc. of Medicine Meets Virtual Reality, J. Westwood, ed., IOS Press Amsterdam pp 586-592 (2002).

B) The books

"The ITK Software Guide: Design and Functionality"
 Fourth Edition
 Johnson, McCormick, Ibanez.
 published by Kitware Inc.
 2015
 ISBN: 9781-930934-28-3
"The ITK Software Guide: Introduction and Development Guidelines"
 Fourth Edition
 Johnson, McCormick, Ibanez.
 published by Kitware Inc.
 2015
 ISBN: 9781-930934-27-6
"Insight into Images"
 edited by Terry Yoo
 published by A.K. Peters 2004
 ISBN: 1-56881-217-5
"The ITK Software Guide"
 Second Edition
 Ibanez, Schroeder, Ng, Cates.
 published by Kitware Inc.
 2005
 ISBN: 1-930934-15-7
"The ITK Software Guide"
 First Edition
 Ibanez, Schroeder, Ng, Cates.
 published by Kitware Inc.
 2003
 ISBN: 1-930934-10-6
"Mastering CMake,
 A Cross-Platform Build System"
 K. Martin and B. Hoffman
 published by Kitware Inc.
 ISBN:  1-930934-09-2

BibTtex citations

 @Manual{johnson2015itk,
    author = {Johnson, Hans J and McCormick, Matthew M and Ibanez, Luis},
    publisher = {Kitware, Inc.},
    title = Template:The ITK Software Guide Book 1: Introduction and Development Guidelines-Volume 1,
    year = {2015}
   }
 @Manual{johnson2015itk,
    author = {Johnson, Hans J and McCormick, Matthew M and Ibanez, Luis},
    publisher = {Kitware, Inc.},
    title = Template:The ITK Software Guide Book 2: Design and Functionality-Volume 2,
    year = {2015}
 }
 @Manual{ITKSoftwareGuide,
   Title          = {The {ITK} {S}oftware {G}uide},
   Author         = {Ibanez, L. and Schroeder, W. and Ng, L. and Cates, J.},
   Organization   = "Kitware, Inc.",
   Edition        = {First},
   year           = {2003},
   note           = {ISBN 1-930934-10-6},
   url            = \href{http://www.itk.org/ItkSoftwareGuide.pdf}{http://www.itk.org/ItkSoftwareGuide.pdf},
   }
 @Manual{ITKSoftwareGuideSecondEdition,
   Title          = {The {ITK} {S}oftware {G}uide},
   Author         = {Ibanez, L. and Schroeder, W. and Ng, L. and Cates, J.},
   Organization   = "Kitware, Inc.",
   Edition        = {Second},
   year           = {2005},
   note           = {ISBN 1-930934-15-7},
   url            = \href{http://www.itk.org/ItkSoftwareGuide.pdf}{http://www.itk.org/ItkSoftwareGuide.pdf},
   }
 @Manual{ITKSoftwareGuideThirdEdition,
   Title          = {The {ITK} {S}oftware {G}uide},
   Author         = {Johnson, Hans J. and McCormick, M. and Ib\'{a}{\~n}ez, L. and The Insight Software Consortium},
   Organization   = "Kitware, Inc.",
   Edition        = {Third},
   year           = {2013},
   note           = {\textit{In press}},
   url            = \href{http://www.itk.org/ItkSoftwareGuide.pdf}{http://www.itk.org/ItkSoftwareGuide.pdf},
   }

C) A specific software version

See:

 https://zenodo.org/record/3592082

If you have a publication that used ITK, please create a pull request to add it to ITKBibliography.bib:

 https://github.com/InsightSoftwareConsortium/insightsoftwareconsortium.org/blob/insightsoftwareconsortium-org/citations/ITKBibliography.bib

If you want to include ITK in an acknowledgment section, a phrase similar to the following may be used:

"This work benefited from the use of the Insight Segmentation
 and Registration Toolkit (ITK), an open source software
 developed as an initiative of the U.S. National Library
 of Medicine and available at www.itk.org."

and

"The multi-platform configuration tool CMake was used for
 configuring ITK and facilitating its use from our project.
 CMake was partially funded by the U.S. National Library of
 Medicine as part of the Insight Toolkit project. CMake is an 
 open source system and it is freely available at www.cmake.org."

Is ITK FDA-Approved?

Given the fact that ITK is a software toolkit, it cannot be the subject of FDA approval as a medical device. We have discussed this topic in several occasions and received advice from FDA representatives, that can be summarized as follow:


 ITK is to be considered as an off-the-shelf (OTS) product that
 is used for supporting a higher level medical application/product.
 The developer of such application/product will be responsible for
 performing the validation processes described in FDA published
 guidelines for the development of software-related medical devices.

For mode details see the page FDA Guidelines for Software Developement

Language bindings

What does "Error opening hint file NOTFOUND" mean?

When you enable "USE_VTK" in the CMake configuration of ITK, and VTK was built with wrapping, CMake looks for a "hints" file.

The "hints" file is on the VTK source tree under: VTK/Wrapping/hints

Please switch CMake to "advanced", look for the VTK_WRAP_HINTS variable and set it to the full path to the "hints" file including the "hints" filename itself.

here is how it looks in the CMakeCache.txt of a typical ITK installation:

//Where can the hints file be found
VTK_WRAP_HINTS:FILEPATH=/home/johndoe/src/VTK/Wrapping/hints

How do I use ITK with WrapITK?

WrapITK allows you to use ITK from other languages. (Python, Java, Ruby, ...)

How do I use ITK from C# .NET?

There are currently three options:

  1. Use ManagedITK
    • NOTE: This option is not recommended as the project is no longer supported
  2. Use the SimpleITK C# language bindings
    • SimpleITK is great, but it does not support all filters (e.g. no support for registration in version 0.5.1)
    • A list of available filters can be found here (valid Sept 2012)
  3. Manually wrap the desired functionality
    • This option requires the most work, but is the most flexible, allowing you to use any ITK functionality you desire
    • An example can be found here

NOTE: WrapITK does not currently support C# language bindings, but could be made to do so.

Using the Insight Toolkit

How do I combine ITK and VTK in my application?

A full tutorial on how to combine ITK and VTK is available at

"Getting Started with ITK and VTK" http://www.itk.org/CourseWare/Training/GettingStarted-II.pdf

You will need the auxiliary classes available at

 ITKApps

For example, for converting ITK images into VTK images and back, you will find useful the files from the ITKVTKGlue module:

     itkImageToVTKImageFilter.h
     itkImageToVTKImageFilter.hxx
     itkVTKImageToImageFilter.h
     itkVTKImageToImageFilter.hxx

How do I configure Emacs for ITK coding style?

You can add the following codes into your .emacs file

;;;;;;;;;;;;;;
(c-add-style "itk"
            '("stroustrup" 
              (c-basic-offset . 2)
              (c-offsets-alist
                (c . c-lineup-dont-change)
                (innamespace . 0)
                (inline-open . 0) 
                (substatement-open . +)
                (statement-block-intro . 0) ) ) )
(add-hook 'c++-mode-hook (function (lambda ()
 (c-set-style "itk")(turn-on-auto-fill))))
(add-to-list 'auto-mode-alist '("\\.txx\\'" . c++-mode)) (add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
;;;;;;;;;;;

How do I configure VIM for ITK coding style?

set tabstop=2 " Tabs are two characters
set shiftwidth=2 " Indents are two charactes too
set expandtab " Do not use tabs
set matchpairs+=<:> " To mach arguments of templates
set cinoptions={1s,:0,l1,g0,c0,(0,(s,m1 " ITK/VTK style indenting

You can also use CMake indentation and syntax file which are available on www.vim.org.

This was contributed by Andy Cedilnik @kitware.com

If you'd like to enable c++ style syntax highlight for *.txx files, put the following lines in your .vimrc file:

syntax on
au BufNewFile,BufRead *.txx set filetype=cpp


What is the "ITK_TEMPLATE_VISIBILITY_DEFAULT" CMake option?

Platform-specific questions

How do I avoid multiple prompts to reload all projects in Microsoft Visual Studio?

When the CMake source changes, you may see multiple prompts to reload many projects.

DO NOT USE "Rebuild All" or "Batch Build". Use the following recommended procedure.

There is an ALL_BUILD target available in the MSVC++ workspace. The best way to build ITK is to set ALL_BUILD as the active project, then select the active configuration you want (DEBUG, etc).

This can also be done from the command line like this: msdev ITK.dsw /MAKE "ALL_BUILD - Debug" /REBUILD

Contribute

How do I make code contributions to ITK?

Please see this page: ITKContribute.

Testing

Is ITK tested?

Please see this page: ITK/Testing

Working with Image Data

How do I iterate through all the pixels in an image?

Please see this example: http://www.itk.org/Wiki/ITK/Examples/Iterators/ImageRegionIterator of itkImageRegionIterator.

What are Hounsfield Units?

Hounsfield units were defined by Sir Godfrey N. Hounsfield, on of the pioneers of Computer Tomography for clinical applications.

The units represent the linear attenuation of X-Rays for a particular material.

The units scale is defined in such a way that level for Water is 0 and the level for Air is -1000.

The attenuation of any other material is mapped linearly into this range.

A table of Hounsfield units for common human tissues is avalable in the following link ITK Hounsfield Units

What are MRI T1 / T2 Units?

MRI images measure two types of relaxation times.

The units are millisecons and the two relaxation concepts relate to how long it takes for the molecules in the tissue to realign themselves with a magentic field after being perturbed.

Details on the MRI units are available in the Wikipedia:

Relaxation (NMR)

DICOM: Bits Allocated, Bits Stored and High Bit

A question that is often asked on insight-users is : I am trying to read/write a DICOM image, but some of the DICOM fields have changed after I write it back on disk.

Here is what you have on disk:

        Bits Allocated = 16
        Bits Stored    = 12
        High Bit       = 11

                          |<------------------ pixel ----------------->|
            ______________ ______________ ______________ ______________
           |XXXXXXXXXXXXXX|              |              |              |
           |______________|______________|______________|______________|
            15          12 11           8 7            4 3            0

Here is what you generally get after writing by GDCM:

        Bits Allocated = 16
        Bits Stored    = 16
        High Bit       = 15

            |<------------------------- pixel ------------------------>|
            ______________ ______________ ______________ ______________
           |              |              |              |              |
           |______________|______________|______________|______________|
            15          12 11           8 7            4 3            0

Since DICOM V3, you cannot store any overlay in the unused bits of the Pixel Data (0x7fe0,0x0010), thus it imply that the unused bits are zeros. In ITK, there is no such thing as 12bits Pixel Type, thus when instanciating your reader you declare a 16bits Pixel Type. This buffer is then passed back to GDCM which sees an array of 16bits values and then simply used the simpliest way to store this buffer back on disk: Bits Stored = 16 and High Bit = 15. In case you have not made any change to your pixel buffer, implicitely the first 4 bits will be zero again. The only difference being that they are not as clearly declared as 12bits.

I'm working with DICOM images, where can I find more information?

ITK/DICOM

Data Display

What imaging software is available for displaying medical image files?

Please see the third party applications page for visualization applications that used ITK to perform Image reading/writing.

When I view the output of my program, all I see is a black image. What went wrong?

ITK is capable of reading and writing data in a variety of formats and bit depths. However many 'consumer' image programs only work with 8-bit data, so when you try to display a 16-bit data file the image will appear black. The solution is to use an image display program that correctly handles these types of files. A small selection is listed above.

ImageMagick is a particularly useful set of tools for image display, manipulation and conversion.

The `ImageViewer` program, part of InsightApplications, is capable of correctly loading and displaying all file types supported by ITK (including anisotropic images).

(Gavin Baker, 24-Jun-2004)

Registration

Can ITK be used for multi-modal registration? For example, CT-MRI, or MRI-fMRI?

ITK provides several method for performing Multi-Modality registration. These methods are described in detail in the SoftwareGuide Chapter 8, pdf-page 241 to 340. In particular you will find interesting Section 8.4 in pdf-page 255 where the Mutual Information metrics are described.

Examples on multimodality registration are available in `Insight/Examples/Registration`. A demo application using Mutual Information is available under `InsightApplications/LandmarkInitializedMutualInformationRegistration`.

It is strongly recommended that you read the chapter on image resampling (Section 6.9.4 of the pdf) before you get involved with image registration methods. That will save you a lot of misunderstandings that are common in new users.

You will also find useful the tutorial sessions, in particular the overview.

(Luis Ibanez, 7-June-2004)

Common Problems

Why can't I read any image files? or Why am I getting the exception message: "There are no registered IO factories."?

When trying to read or write a file using the ImageFileReader or the ImageFileWriter I got an exception with the following message:

itk::ImageFileReaderException (00F7F494)
Location: "Unknown"
File: C:\ITK\InsightToolkit-1.6.0\Code\IO\itkImageFileReader.hxx
Line: 101
Description: Could not create IO object for file c:\t1.mnc

This exception is thrown when ITK does not recognize the fileformat that you are trying to read or write. When reading, ITK recognize file formats by asking a set of internal readers to attempt to read your file. If none of the registered readers accept your file, then the exception above is thrown. When writing, ITK uses the extension of the filename in order to chose the fileformat to be used. Make sure that you use one of the filename extensions recognized by ITK, and that the ImageIO class for that format has been registered.

Enable all the IO modules that you wish to support in your ITK CMake configuration.

To register the IO factory:

  • If you are using CMake: call include( ${ITK_USE_FILE} ) before add_executable or add_library.
  • If you are not using CMake: the factories should be registered with itk::XXXImageIOFactory::RegisterOneFactory() where XXX is the format.
  • You may need to add something to the REQUIRED list of the FIND_PACKAGE call that includes ITK from your project. For example, if you were trying to open a png file when you got this error, ensure your CMakeLists.txt contains FIND_PACKAGE(ITK REQUIRED ITKIOPNG)



ITK: [Welcome | Site Map]