1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720
|
/*=========================================================================
Program: ITK-SNAP
Module: $RCSfile: ImageWrapper.h,v $
Language: C++
Date: $Date: 2009/11/13 00:59:47 $
Version: $Revision: 1.14 $
Copyright (c) 2007 Paul A. Yushkevich
This file is part of ITK-SNAP
ITK-SNAP is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-----
Copyright (c) 2003 Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __ImageWrapper_h_
#define __ImageWrapper_h_
// Smart pointers have to be included from ITK, can't forward reference them
#include "RLEImageScanlineIterator.h"
#include "ImageWrapperBase.h"
#include "ImageCoordinateGeometry.h"
#include <itkVectorImage.h>
#include <itkRGBAPixel.h>
#include <DisplayMappingPolicy.h>
#include <itkSimpleDataObjectDecorator.h>
// Forward declarations to IRIS classes
template <class TFunctor> class UnaryValueToValueFilter;
template <class TInputImage, class TOutputImage, class TTraits>
class AdaptiveSlicingPipeline;
class SNAPSegmentationROISettings;
namespace itk {
template <unsigned int VDimension> class ImageBase;
template <class TImage> class ImageSource;
template <typename TScalar, unsigned int V1, unsigned int V2> class Transform;
template<typename TInputImage,
typename TOutputImage,
typename TInterpolatorPrecisionType,
typename TTransformPrecisionType> class ResampleImageFilter;
template<typename TInputImage,
typename TOutputImage> class ExtractImageFilter;
}
#include <itkImageSource.h>
/**
* \class ImageWrapper
* \brief A wrapper around an itk::OrientedImage and related pipelines.
*
* Image Wrapper serves as a wrapper around an image pointer, and
* is used to unify the treatment of different kinds of images in
* SNaP. The image wrapper is parameterized by a base class TBase.
* This is done to avoid multiple inheritance. TBase must be a
* subclass of ImageWrapperBase.
*/
template<class TTraits, class TBase = ImageWrapperBase>
class ImageWrapper : public TBase
{
public:
// Standard ITK business
typedef ImageWrapper<TTraits, TBase> Self;
typedef TBase Superclass;
typedef SmartPtr<Self> Pointer;
typedef SmartPtr<const Self> ConstPointer;
itkTypeMacro(ImageWrapper, TBase)
// Basic type definitions
typedef typename Superclass::ImageBaseType ImageBaseType;
typedef typename TTraits::ImageType ImageType;
typedef SmartPtr<ImageType> ImagePointer;
typedef typename ImageType::PixelType PixelType;
// This is the pixel type of the buffer pointer, i.e., internal representation
typedef typename ImageType::InternalPixelType InternalPixelType;
// This is the type of the outwardly visible components in the image. For
// wrappers that encapsulate 'real' images and vector images, this is the same
// as the internal pixel type, but for wrappers that encapsulate an image
// adaptor, the component type is the output type of the adaptor
typedef typename TTraits::ComponentType ComponentType;
// This is the type of the intermediate 'preview' images used in the slicing
// pipeline. For regular image and vector image wrappers, this is the same as
// ImageType, but for adapter-based image wrappers, this is a concrete image
typedef itk::Image<PixelType, 3> PreviewImageType;
// Slice image type
typedef typename TTraits::SliceType SliceType;
typedef SmartPtr<SliceType> SlicePointer;
// Display slice type - inherited
typedef typename Superclass::DisplayPixelType DisplayPixelType;
typedef typename Superclass::DisplaySliceType DisplaySliceType;
typedef typename Superclass::DisplaySlicePointer DisplaySlicePointer;
// Slicer type
typedef AdaptiveSlicingPipeline<ImageType, SliceType, PreviewImageType> SlicerType;
typedef SmartPtr<SlicerType> SlicerPointer;
// Preview source for preview pipelines
typedef itk::ImageSource<PreviewImageType> PreviewFilterType;
// Iterator types
typedef typename itk::ImageRegionIterator<ImageType> Iterator;
typedef typename itk::ImageRegionConstIterator<ImageType> ConstIterator;
// Other types from parent
typedef typename Superclass::TransformType TransformType;
// Internal intensity to display intensity mapping
typedef typename TTraits::DisplayMapping DisplayMapping;
// Native intensity mapping
typedef typename TTraits::NativeIntensityMapping NativeIntensityMapping;
// Objects used to represent min/max intensity in the image
typedef itk::SimpleDataObjectDecorator<ComponentType> ComponentTypeObject;
typedef itk::SimpleDataObjectDecorator<double> DoubleObject;
// ITK's coordinate transform (rigid, affine, etc)
typedef typename Superclass::ITKTransformType ITKTransformType;
/**
* Get the parent wrapper for this wrapper. For 'normal' wrappers, this method
* returns NULL, indicating that the wrapper is a top-level wrapper. For derived
* wrappers (i.e., components and scalar representations of vector wrappers),
* this method returns the vector wrapper from which the wrapper is derived.
*
* You should not have to call the SetParentWrapper method. It's used internally
*/
irisGetSetMacro(ParentWrapper, ImageWrapperBase *)
/**
* Initialize the image wrapper to match another image wrapper, setting the
* image pixels to a default value. The slice indices and the transforms will
* all be updated to match the source
*/
virtual void InitializeToWrapper(
const ImageWrapperBase *source, const PixelType &value);
/**
* Initialize the image wrapper with a combination of another image wrapper and
* an actual image. This will update the indices and transforms from the
* source wrapper, otherwise, it's equivalent to SetImage()
*/
virtual void InitializeToWrapper(
const ImageWrapperBase *source, ImageType *image, ImageBaseType *refSpace, ITKTransformType *tran);
/**
Get a unique id for this wrapper. All wrappers ever created have
different ids.
*/
irisGetMacro(UniqueId, unsigned long)
/**
Does this wrapper use the non-orthogonal slicing pipeline?
*/
virtual bool IsSlicingOrthogonal() const;
/**
* Clear the data associated with storing an image
*/
virtual void Reset();
/** Get the coordinate transform for each display slice */
virtual const ImageCoordinateTransform *GetImageToDisplayTransform(
unsigned int) const;
/**
* Set the coordinate transformation between the display coordinates and
* the anatomical coordinates. This affects the behavior of the slicers
*/
virtual void SetDisplayGeometry(const IRISDisplayGeometry &dispGeom);
/** Get the display to anatomy coordinate mapping */
irisGetMacro(DisplayGeometry, const IRISDisplayGeometry &)
/** Set the direction matrix of the image */
virtual void SetDirectionMatrix(const vnl_matrix<double> &direction);
/**
* Set the image coordinate transform (origin, spacing, direction) to
* match those of a reference wrapper
*/
virtual void CopyImageCoordinateTransform(const ImageWrapperBase *source);
/**
* Get the image geometry from the wrapper
*/
irisGetMacro(ImageGeometry, const ImageCoordinateGeometry &)
/** Get the current slice index - which really means cursor position */
irisGetMacro(SliceIndex, Vector3ui)
/** Return some image info independently of pixel type */
ImageBaseType* GetImageBase() const { return m_Image; }
/**
* Is the image initialized?
*/
irisIsMacro(Initialized)
/**
* Get the size of the image
*/
Vector3ui GetSize() const;
/** Get layer transparency */
irisSetWithEventMacro(Alpha, double, WrapperDisplayMappingChangeEvent)
/** Set layer transparency */
irisGetMacro(Alpha, double)
/**
* Get layer stickiness. A sticky layer always is shown 'on top' of other
* layers, e.g., the segmentation layer, or the level set image. A layer that
* is not sticky is shown in its own tile when the display is in tiled mode
*/
irisSetWithEventMacro(Sticky, bool, WrapperVisibilityChangeEvent)
/** Set layer stickiness */
irisIsMacro(Sticky)
/**
* Whether the layer is drawable. Some layers may be initialized, but not
* yet computed, in which case they should not yet be drawn.
*/
virtual bool IsDrawable() const;
/** Get the buffered region of the image */
virtual itk::ImageRegion<3> GetBufferedRegion() const;
/** Transform a voxel index into a spatial position */
virtual Vector3d TransformVoxelIndexToPosition(const Vector3i &iVoxel) const ;
/** Transform a voxel index into a spatial position */
virtual Vector3d TransformVoxelCIndexToPosition(const Vector3d &iVoxel) const;
/** Transform spatial position to voxel continuous index (LPS) */
virtual Vector3d TransformPositionToVoxelCIndex(const Vector3d &vLPS) const;
/** Transform spatial position to voxel index (LPS) */
virtual Vector3i TransformPositionToVoxelIndex(const Vector3d &vLPS) const;
/** Transform a voxel index into NIFTI coordinates (RAS) */
virtual Vector3d TransformVoxelCIndexToNIFTICoordinates(const Vector3d &iVoxel) const;
/** Transform NIFTI coordinates to a continuous voxel index */
virtual Vector3d TransformNIFTICoordinatesToVoxelCIndex(const Vector3d &vNifti) const;
/** Get the NIFTI s-form matrix for this image */
irisGetMacro(NiftiSform, TransformType)
/** Get the inverse NIFTI s-form matrix for this image */
irisGetMacro(NiftiInvSform, TransformType)
/** Set the voxel at a given position.*/
void SetVoxel(const Vector3ui &index, const PixelType &value);
void SetVoxel(const itk::Index<3> &index, const PixelType &value);
/**
* Get a constant reference to a voxel at a given position.
*/
PixelType GetVoxel(unsigned int x,
unsigned int y,
unsigned int z) const;
PixelType GetVoxel(const Vector3ui &index) const;
PixelType GetVoxel(const itk::Index<3> &index) const;
/**
* Get the mapping between the internal data type and the 'native' range,
* i.e., the range of values shown to the user. This may be a linear mapping
* or an identity mapping. This method returns an abstract type;
*/
virtual const AbstractNativeIntensityMapping *GetNativeIntensityMapping() const
{ return &m_NativeMapping; }
/** These methods access the native mapping in its actual type */
irisGetMacro(NativeMapping, NativeIntensityMapping)
irisSetMacro(NativeMapping, NativeIntensityMapping)
/** Get the intensity to display mapping */
DisplayMapping *GetDisplayMapping()
{ return m_DisplayMapping; }
/** Get the intensity to display mapping */
const DisplayMapping *GetDisplayMapping() const
{ return m_DisplayMapping; }
/**
* Return the pointed to the ITK image encapsulated by this wrapper.
*/
virtual ImageType *GetImage() const
{ return m_Image; }
/**
* Get the slicer inside this wrapper
*/
virtual SlicerType *GetSlicer(unsigned int iDirection) const
{ return m_Slicer[iDirection]; }
/**
* Set the current slice index in all three dimensions. The index should
* be specified in the image coordinates, the slices will be generated
* in accordance with the transforms that are specified
*/
virtual void SetSliceIndex(const Vector3ui &cursor);
const ImageBaseType* GetDisplayViewportGeometry(unsigned int index) const;
virtual void SetDisplayViewportGeometry(
unsigned int index,
const ImageBaseType *viewport_image);
/**
* Get an ITK pipeline object holding the minimum value in the image. For
* multi-component images, this is the minimum value over all components.
*/
virtual ComponentTypeObject *GetImageMinObject() const = 0;
virtual ComponentTypeObject *GetImageMaxObject() const = 0;
/** Return componentwise minimum cast to double, without mapping to native range */
virtual double GetImageMinAsDouble();
/** Return componentwise maximum cast to double, without mapping to native range */
virtual double GetImageMaxAsDouble();
/** Return componentwise minimum cast to double, after mapping to native range */
virtual double GetImageMinNative();
/** Return componentwise maximum cast to double, after mapping to native range */
virtual double GetImageMaxNative();
/**
* Get a slice of the image in a given direction
*/
virtual SliceType *GetSlice(unsigned int dimension);
/**
* This method exposes the scalar pointer in the image
*/
//virtual InternalPixelType *GetVoxelPointer() const;
/** Number of voxels */
virtual size_t GetNumberOfVoxels() const;
/**
* Pring debugging info
* TODO: Delete this or make is worthwhile
*/
virtual void PrintDebugInformation();
/**
* Replace the image internally stored in this wrapper by another image.
*/
virtual void SetImage(ImagePointer newImage);
/**
* Set the wrapper to hold an image that is in a coordinate space that is
* different from the program's main reference space
*/
virtual void SetImage(ImagePointer newImage, ImageBaseType *refSpace, ITKTransformType *transform);
/**
* Update the transform between the coordinate space of this image and the program's
* main reference space
*/
virtual void SetITKTransform(ImageBaseType *referenceSpace, ITKTransformType *transform);
/**
* Get the ITK transform between this layer and its reference space
*/
virtual const ITKTransformType *GetITKTransform() const;
/**
* Get the reference space space in which this image is defined
*/
virtual ImageBaseType* GetReferenceSpace() const;
/**
* Extract a region of interest from the image wrapper, as a new wrapper of
* the same type
*/
virtual SmartPtr<ImageWrapperBase> ExtractROI(
const SNAPSegmentationROISettings &roi, itk::Command *progressCommand) const;
/**
* This method is used to perform a deep copy of a region of this image
* into another image, potentially resampling the region to use a different
* voxel size
*/
virtual ImagePointer DeepCopyRegion(const SNAPSegmentationROISettings &roi,
itk::Command *progressCommand = NULL) const;
/**
* Get an iterator for traversing the image. The iterator is initialized
* to point to the beginning of the image
*/
virtual ConstIterator GetImageConstIterator() const;
virtual Iterator GetImageIterator();
/** For each slicer, find out which image dimension does is slice along */
unsigned int GetDisplaySliceImageAxis(unsigned int slice);
/**
* Replace all voxels with intensity values iOld with values iNew.
* \return number of voxels that had been modified
*/
virtual unsigned int ReplaceIntensity(PixelType iOld, PixelType iNew);
/**
* Swap intensity values iFirst and iSecond
* \return number of voxels that had been modified
*/
virtual unsigned int SwapIntensities(PixelType iFirst, PixelType iSecond);
/**
* Get the display slice
*/
DisplaySlicePointer GetDisplaySlice(unsigned int dim);
/**
Attach a preview pipeline to the wrapper. This is used with wrappers that
represent results of image processing operations, such as speed images.
A preview pipeline consists of a filter for each of the three slice
directions. When the upstream information in these filters is newer than
the image volume stored in the wrapper, the slices returned with
GetDisplaySlice() will be those from the preview filters rather than from
the image volume.
*/
virtual void AttachPreviewPipeline(
PreviewFilterType *f0, PreviewFilterType *f1, PreviewFilterType *f2);
/**
Detach the preview pipeline from the wrapper. The wrapper will always
return slices from the internally stored image volume.
*/
virtual void DetachPreviewPipeline();
/**
Report whether the preview pipeline is attached.
*/
virtual bool IsPreviewPipelineAttached() const;
/**
* A flag governing whether the preview pipeline is ready or not. This is
* used to determine whether the layer is drawable (only relevant if the
* pipeline is attached)
*/
irisIsMacro(PipelineReady)
irisSetMacro(PipelineReady, bool)
/**
* Set the filename of the image wrapper. If the wrapper does not have a
* nickname, the nickname will be changed to the file part of the filename.
*/
void SetFileName(const std::string &name);
// Access the filename
irisGetStringMacro(FileName)
/**
* Fallback nickname - shown if no filename and no custom nickname set.
*/
irisGetSetMacro(DefaultNickname, const std::string &)
/**
* Get the nickname of the image. A nickname is a shorter description of the
* image that is displayed to the user. If a custom nickname is not set, it
* defaults to the filename (without path). If there is no filename (i.e.,
* the layer is internal), the default nickname is used.
*/
const std::string &GetNickname() const;
/**
* Set the custom nickname for the wrapper.
*/
virtual void SetCustomNickname(const std::string &nickname);
irisGetMacro(CustomNickname, const std::string &);
/**
* Access the "IO hints" registry associated with this wrapper. The IO hints
* are used to help read the image when the filename alone is not sufficient.
* For example, it may contain the DICOM series ID of the image, or for a raw
* image the dimensions.
*/
virtual const Registry &GetIOHints() const;
/**
* Set the IO hints
*/
virtual void SetIOHints(const Registry &io_hints);
/**
* Write the image to disk with the help of the GuidedNativeImageIO object
*/
virtual void WriteToFile(const char *filename, Registry &hints);
/**
* Create a thumbnail from the image and write it to a .png file
*/
void WriteThumbnail(const char *filename, unsigned int maxdim);
/**
* Save metadata to a Registry file. The metadata are data that are not
* contained in the image header are need to be restored when the image
* is reloaded. Currently, this mainly includes the display mapping, but
* also the transparency, etc.
*/
virtual void WriteMetaData(Registry ®);
/**
* Restore metadata from a registry
*/
virtual void ReadMetaData(Registry ®);
/**
* Check if the image has unsaved changes
*/
virtual bool HasUnsavedChanges() const;
/**
* The image wrapper has a generic mechanism for associating data with it.
* For example, we can associate some parameter values for a specific
* image processing algorithm with each layer. Do do that, we simply
* assign a pointer to the data to a specific string role. Internally,
* a smart pointer is used to point to the associated data.
*
* Users of this method might also want to rebroadcast events from the
* associated object as events of type WrapperUserChangeEvent(). These
* events will then propagate all the way up to the IRISApplication.
*/
void SetUserData(const std::string &role, itk::Object *data);
/**
* Get the user data associated with this wrapper for a specific role. If
* no association exists, NULL is returned. The method is templated over the
* return type to avoid casting in user code.
*/
itk::Object* GetUserData(const std::string &role) const;
protected:
/**
* Default constructor. Creates an image wrapper with a blank internal
* image
*/
ImageWrapper();
/**
* Copy constructor. Copies the contents of the passed-in image wrapper.
*/
ImageWrapper(const Self ©);
/** Destructor */
virtual ~ImageWrapper();
/** A unique Id of this wrapper. Used for the LayerAssociation code */
unsigned long m_UniqueId;
/** The image that we are wrapping */
ImagePointer m_Image;
/** The associated slicer filters */
SlicerPointer m_Slicer[3];
/** The wrapped image */
SmartPtr<ImageBaseType> m_ImageBase;
/** The reference space - this is the space into which the image is sliced */
SmartPtr<ImageBaseType> m_ReferenceSpace;
/** The current cursor position (slice index) in image dimensions */
Vector3ui m_SliceIndex;
/**
* Is the image wrapper initialized? That is a prerequisite for all
* operations.
*/
bool m_Initialized;
/** Pipeline readiness */
bool m_PipelineReady;
/** Transparency */
double m_Alpha;
/** Stickiness (whether the layer can be tiled or not) */
bool m_Sticky;
/** Time when the internal image was allocated, and when it was last saved */
itk::TimeStamp m_ImageAssignTime, m_ImageSaveTime;
/** The pipeline that handles mapping intensities to the display slices */
SmartPtr<DisplayMapping> m_DisplayMapping;
// Mapping from native to internal format
NativeIntensityMapping m_NativeMapping;
// Mapping between the display coordinates and anatomical coordinates
IRISDisplayGeometry m_DisplayGeometry;
// This object encapsulates information about the coordinate mapping between
// the image coordinate space, the anatomical coordinate space, and the
// display coordinate space. It depends on three parameters: the size of the
// image, the Direction cosine matrix of the image, and the DisplayGeometry
// (transformation between the display and the anatomy spaces).
//
// The code should not directly modify this variable. It should only be
// modified by the UpdateImageGeometry() method.
ImageCoordinateGeometry m_ImageGeometry;
// Transform from image index to NIFTI world coordinates. This is derived
// from the origin, spacing, and direction cosine matrix in the image header.
TransformType m_NiftiSform, m_NiftiInvSform;
// Each layer has a filename, from which it is belived to have come
std::string m_FileName, m_FileNameShort;
// Each layer has a nickname. But this gets complicated, because the nickname
// can be set by the user, or it can be default for the wrapper, or it can be
// derived from the filename. The nicknames are used in the following order.
// - if there is a custom nickname, it is shown
// - if there is a filename, nickname is set to the shortened filename
// - if there is no filename, nickname is set to the default nickname
std::string m_DefaultNickname, m_CustomNickname;
// A map to store user-associated data
typedef std::map<std::string, SmartPtr<itk::Object> > UserDataMapType;
UserDataMapType m_UserDataMap;
// IO Hints registry
Registry *m_IOHints;
/**
* Handle a change in the image pointer (i.e., a load operation on the image or
* an initialization operation). This function can take two optional parameters:
* the reference space and a transform. If these parameters are not NULL, then the
* wrapper represents a spatially transformed image. The slicers in the wrapper will
* slice not along the orthogonal directions in the image, but along directions in
* the reference space.
*/
virtual void UpdateImagePointer(ImageType *image,
ImageBaseType *refSpace = NULL,
ITKTransformType *tran = NULL);
/**
* Update the image geometry (combining the information in the image and the
* information in the m_DisplayGeometry variable)
*/
virtual void UpdateImageGeometry();
/**
* Update the NIFTI header. This should be called whenever the spacing,
* origin, or direction cosine matrix of the image are changed
*/
virtual void UpdateNiftiTransforms();
/** Common code for the different constructors */
void CommonInitialization();
/** Parent wrapper */
ImageWrapperBase *m_ParentWrapper;
/**
* Resampling filter data type. These filters are used when slicing is required in
* non-orthogonal directions. There are four of these filters, and they are used to
* produce three display slices and also a complete image that matches the dimensions
* of the main image (this is for feature extraction, etc.)
*/
typedef itk::ResampleImageFilter<ImageType, PreviewImageType, double, double> ResampleFilter;
SmartPtr<ResampleFilter> m_ResampleFilter[6];
// Compare the geometry (size and header) of two images. Returns true if the headers are
// within tolerance of each other.
static bool CompareGeometry(ImageBaseType *image1, ImageBaseType *image2, double tol = 0.0);
// Check if the orthogonal slicer can be used for the given image, ref space and transform
static bool CanOrthogonalSlicingBeUsed(
ImageType *image, ImageBaseType *referenceSpace, ITKTransformType *transform);
// Update the orthogonal and/or non-orthogonal slicing pipelines
void UpdateSlicingPipelines(ImageType *image, ImageBaseType *referenceSpace, ITKTransformType *transform);
};
#endif // __ImageWrapper_h_
|