Difference between revisions of "IpPic Free Core"

From mitk.org
Jump to navigation Jump to search
(username removed)
 
(Typo in Page Name)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
<!-- ## page was renamed from development/IpPicFreeCore -->
 +
<!-- ## page was renamed from internal/IpPicFreeCore -->
 
= [[IpPic]] free Core =
 
= [[IpPic]] free Core =
  
 
This page documentes the changes in the interface and code structure which were necessary for completely removing the dependancy of the Core module to the IpPic module.  
 
This page documentes the changes in the interface and code structure which were necessary for completely removing the dependancy of the Core module to the IpPic module.  
  
Consequently, the `.pic` data format was replaced by the `.nrrd` data format on the position of the standard MITK data format. In near future, storing to a `.pic` will be disabled. The reading-in of `.pic` will be supported longer.
+
Consequently, the `.pic` data format was replaced by the `.nrrd` data format on the position of the standard MITK data format. In the near future, storing to a `.pic` will be disabled. The loading of `.pic` will be supported longer.
  
 
The most affected class is `mitk::Image` since the whole management of the image data was done by the `[[IpPicDescriptor]]`.  
 
The most affected class is `mitk::Image` since the whole management of the image data was done by the `[[IpPicDescriptor]]`.  
Line 10: Line 12:
 
== Changes in mitk::Image ==
 
== Changes in mitk::Image ==
  
 +
 +
<pre><nowiki>#!wiki important
 +
'''Summary'''
 +
 +
The art of changes in the `Image` class is twofold. First, the !IpPicDescriptor and all related methods were replaced by new descriptor objects. Second, as part of the refactoring, the whole statistics computation was moved into a new object.
 +
</nowiki></pre>
 +
 +
 +
=== New descriptors ===
 +
 +
The IpPicDescriptor got replaced by two new descriptors:
 +
 +
* '''mitk::ImageDescriptor''' which holds the dimension information for the image and a `std::vector` of descriptors for the image's channels
 +
* '''mitk::ChannelDescriptor''' which holds the essential information for a channel, i.e. its size and pixel type
 +
 +
=== Image statistics ===
 +
 +
All members of the `mitk::Image` class related to statistics computation were moved to a new object '''ImageStatisticsHolder'''. For temporary backward compatibility, the methods for accessing the statistics like `[[GetScalarValueMax]]()` are still available in the interface of mitk::!Image, but are marked as deprecated. ''Old-style'' calls like:
 +
 +
<pre><nowiki>#!highlight cpp
 +
double scMax = m_Image->GetScalarValueMax();
 +
</nowiki></pre>
 +
 +
have to be replaced by:
 +
 +
<pre><nowiki>#!highlight cpp
 +
double scMax = m_Image->GetStatistics()->GetScalarValueMax();
 +
</nowiki></pre>
 +
 +
 +
== Changes in mitk::[[PixelType]] ==
 +
 +
With IpPic present, the PixelType was forced to hold a member of type `mitkIpPicType_t`. The re-worked PixelType stores the `std::type_info`. Also the creation of a PixelType instance has changed. There are three methods how to instantiate a PixelType object:
 +
 +
Single component pixel types ( i.e. scalar types) can be created like the following `float` type:
 +
 +
<pre><nowiki>#!highlight cpp
 +
mitk::PixelType myScalarPType =
 +
  mitk::MakeScalarPixelType< float >();
 +
</nowiki></pre>
 +
 +
PixelType instances for ITK image types are created like:
 +
 +
<pre><nowiki>#!highlight cpp
 +
typedef itk::Image<itk::RGBAPixel<unsigned char>, 3> itkImageType;
 +
 +
mitk::PixelType myPType = mitk::MakePixelType<itkImageType>();
 +
</nowiki></pre>
 +
 +
And fully customized PixelType instances are created like:
 +
 +
<pre><nowiki>#!highlight cpp
 +
mitk::PixelType myCustomPType =
 +
  mitk::MakePixelType<char, YMKType<char>, 3>();
 +
</nowiki></pre>
 +
 +
 +
There are two public methods for getting the type_info from a PixelType object.
 +
* `[[GetPixelTypeId]]()` returns the type of the whole pixel type
 +
* `[[GetTypeId]]()` returns the type of the component ( i.e. unsigned char for the myPType in the example given above)
 
== Usage of [[IpPic]] ==
 
== Usage of [[IpPic]] ==
  

Revision as of 14:09, 12 February 2013

IpPic free Core

This page documentes the changes in the interface and code structure which were necessary for completely removing the dependancy of the Core module to the IpPic module.

Consequently, the `.pic` data format was replaced by the `.nrrd` data format on the position of the standard MITK data format. In the near future, storing to a `.pic` will be disabled. The loading of `.pic` will be supported longer.

The most affected class is `mitk::Image` since the whole management of the image data was done by the `IpPicDescriptor`.

Changes in mitk::Image

#!wiki important
'''Summary''' 

The art of changes in the `Image` class is twofold. First, the !IpPicDescriptor and all related methods were replaced by new descriptor objects. Second, as part of the refactoring, the whole statistics computation was moved into a new object.


New descriptors

The IpPicDescriptor got replaced by two new descriptors:

  • mitk::ImageDescriptor which holds the dimension information for the image and a `std::vector` of descriptors for the image's channels
  • mitk::ChannelDescriptor which holds the essential information for a channel, i.e. its size and pixel type

Image statistics

All members of the `mitk::Image` class related to statistics computation were moved to a new object ImageStatisticsHolder. For temporary backward compatibility, the methods for accessing the statistics like `GetScalarValueMax()` are still available in the interface of mitk::!Image, but are marked as deprecated. Old-style calls like:

#!highlight cpp
double scMax = m_Image->GetScalarValueMax();

have to be replaced by:

#!highlight cpp
double scMax = m_Image->GetStatistics()->GetScalarValueMax();


Changes in mitk::PixelType

With IpPic present, the PixelType was forced to hold a member of type `mitkIpPicType_t`. The re-worked PixelType stores the `std::type_info`. Also the creation of a PixelType instance has changed. There are three methods how to instantiate a PixelType object:

Single component pixel types ( i.e. scalar types) can be created like the following `float` type:

#!highlight cpp
mitk::PixelType myScalarPType = 
  mitk::MakeScalarPixelType< float >();

PixelType instances for ITK image types are created like:

#!highlight cpp
typedef itk::Image<itk::RGBAPixel<unsigned char>, 3> itkImageType;

mitk::PixelType myPType = mitk::MakePixelType<itkImageType>();

And fully customized PixelType instances are created like:

#!highlight cpp
mitk::PixelType myCustomPType =
  mitk::MakePixelType<char, YMKType<char>, 3>();


There are two public methods for getting the type_info from a PixelType object.

  • `GetPixelTypeId()` returns the type of the whole pixel type
  • `GetTypeId()` returns the type of the component ( i.e. unsigned char for the myPType in the example given above)

Usage of IpPic

Multiple algorithms located in the MitkExt module and also some Bundles still need to have access to the IpPic module. To provide backward compatibility, there are now two new modules

  • IpPicSupport
    • contains all I/O related classes (`Writer`, `Reader`, `IOFactory`) previously located in Core/
  • LegacyAdaptors