Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

mitk::VolumeVisualizationImagePreprocessor Class Reference

#include <mitkVolumeVisualizationImagePreprocessor.h>

List of all members.

Public Types

typedef
VolumeVisualizationImagePreprocessor 
Self
typedef itk::Object Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
mitk::Image::Pointer Process (mitk::Image::Pointer originalCT, mitk::Image::Pointer originalLiverMask)
double GetEstimatedThreshold () const
double GetMinThreshold () const
double GetMaxThreshold () const
double GetLastUsedThreshold () const
mitk::TransferFunction::Pointer GetInitialTransferFunction ()
void UpdateTransferFunction (mitk::TransferFunction::Pointer tf, int treshold)

Static Public Member Functions

static Pointer New ()

Protected Types

typedef itk::Image< short, 3 > CTImage
typedef
itk::ImageRegionIterator
< CTImage
CTIteratorType
typedef
itk::ImageRegionIteratorWithIndex
< CTImage
CTIteratorIndexType
typedef itk::Image< unsigned
char, 3 > 
BinImage
typedef
itk::ImageRegionIterator
< BinImage
BinIteratorType
typedef
itk::ImageRegionIteratorWithIndex
< BinImage
BinIteratorIndexType
typedef itk::Image< unsigned
short, 3 > 
LabelImage
typedef
itk::ImageRegionIterator
< LabelImage
LabelIteratorType

Protected Member Functions

 VolumeVisualizationImagePreprocessor ()
 ~VolumeVisualizationImagePreprocessor ()
CTImage::Pointer Composite (CTImage::Pointer work, BinImage::Pointer mask, BinImage::Pointer dilated, BinImage::Pointer eroded)
void DetermineBoundingBox (BinImage::Pointer mask)
CTImage::Pointer Crop (CTImage::Pointer src)
BinImage::Pointer Crop (BinImage::Pointer src)
BinImage::Pointer Dilate (BinImage::Pointer src)
BinImage::Pointer Erode (BinImage::Pointer src)
CTImage::Pointer Gaussian (CTImage::Pointer src)
LabelImage::Pointer ConnectComponents (BinImage::Pointer src)
LabelImage::Pointer RelabelComponents (LabelImage::Pointer src)
BinImage::Pointer Threshold (CTImage::Pointer src, int threshold)
int GetHistogrammValueFromTop (double part)
int GetHistogrammValueFromBottom (double part)

Protected Attributes

double m_OutOfLiverValue
double m_surfaceValue
double m_realSurfaceValue
double m_realInLiverValue
double m_EstimatedThreshold
double m_GreatestStructureThreshold
double m_MinThreshold
double m_MaxThreshold
int m_MinX
int m_MinY
int m_MinZ
int m_MaxX
int m_MaxY
int m_MaxZ
int m_LastUsedTreshold
int histogramm [65536]
int total

Detailed Description

Definition at line 57 of file mitkVolumeVisualizationImagePreprocessor.h.


Member Typedef Documentation

typedef itk::Image<unsigned char, 3 > mitk::VolumeVisualizationImagePreprocessor::BinImage [protected]

Definition at line 100 of file mitkVolumeVisualizationImagePreprocessor.h.

typedef itk::ImageRegionIteratorWithIndex< BinImage > mitk::VolumeVisualizationImagePreprocessor::BinIteratorIndexType [protected]

Definition at line 102 of file mitkVolumeVisualizationImagePreprocessor.h.

typedef itk::ImageRegionIterator< BinImage > mitk::VolumeVisualizationImagePreprocessor::BinIteratorType [protected]

Definition at line 101 of file mitkVolumeVisualizationImagePreprocessor.h.

Definition at line 61 of file mitkVolumeVisualizationImagePreprocessor.h.

Definition at line 96 of file mitkVolumeVisualizationImagePreprocessor.h.

typedef itk::ImageRegionIteratorWithIndex< CTImage > mitk::VolumeVisualizationImagePreprocessor::CTIteratorIndexType [protected]

Definition at line 98 of file mitkVolumeVisualizationImagePreprocessor.h.

typedef itk::ImageRegionIterator< CTImage > mitk::VolumeVisualizationImagePreprocessor::CTIteratorType [protected]

Definition at line 97 of file mitkVolumeVisualizationImagePreprocessor.h.

typedef itk::Image<unsigned short, 3 > mitk::VolumeVisualizationImagePreprocessor::LabelImage [protected]

Definition at line 104 of file mitkVolumeVisualizationImagePreprocessor.h.

typedef itk::ImageRegionIterator< LabelImage > mitk::VolumeVisualizationImagePreprocessor::LabelIteratorType [protected]

Definition at line 105 of file mitkVolumeVisualizationImagePreprocessor.h.

Definition at line 61 of file mitkVolumeVisualizationImagePreprocessor.h.

Definition at line 61 of file mitkVolumeVisualizationImagePreprocessor.h.

Definition at line 61 of file mitkVolumeVisualizationImagePreprocessor.h.


Constructor & Destructor Documentation

mitk::VolumeVisualizationImagePreprocessor::VolumeVisualizationImagePreprocessor (  ) [protected]
mitk::VolumeVisualizationImagePreprocessor::~VolumeVisualizationImagePreprocessor (  ) [protected]

Definition at line 41 of file mitkVolumeVisualizationImagePreprocessor.cpp.

{
}

Member Function Documentation

mitk::VolumeVisualizationImagePreprocessor::CTImage::Pointer mitk::VolumeVisualizationImagePreprocessor::Composite ( CTImage::Pointer  work,
BinImage::Pointer  mask,
BinImage::Pointer  dilated,
BinImage::Pointer  eroded 
) [protected]

Definition at line 450 of file mitkVolumeVisualizationImagePreprocessor.cpp.

References GetHistogrammValueFromBottom(), GetHistogrammValueFromTop(), histogramm, int(), m_EstimatedThreshold, m_GreatestStructureThreshold, m_MaxThreshold, m_MinThreshold, m_OutOfLiverValue, m_realInLiverValue, m_realSurfaceValue, m_surfaceValue, QuadProgPP::sum(), total, and VVP_INFO.

Referenced by Process().

{
  VVP_INFO << "Compositing...";
  
  /*
  itk::OrImageFilter<CTImage, CTImage, CTImage>::Pointer nullFilter= itk::OrImageFilter<CTImage, CTImage, CTImage>::New();
  nullFilter->SetInput1( input );
  nullFilter->SetInput2( input );
  nullFilter->UpdateLargestPossibleRegion();
  CTImage::Pointer work = nullFilter->GetOutput();
  */

  CTIteratorIndexType workIt( work, work->GetRequestedRegion() );
  BinIteratorType maskIt( mask, mask->GetRequestedRegion() );
  BinIteratorType dilateIt( dilated, dilated->GetRequestedRegion() );
  BinIteratorType erodeIt( eroded, eroded->GetRequestedRegion() );
  
  workIt.GoToBegin();
  maskIt.GoToBegin();
  dilateIt.GoToBegin();
  erodeIt.GoToBegin();

  double sum=0;
  int num=0;
  
  double sumIn=0;
  int numIn=0;

  int _min=32767,_max=-32768;
  
  total=0;
  memset(histogramm,0,sizeof(int)*65536);
  
  while ( ! ( workIt.IsAtEnd() || maskIt.IsAtEnd() || dilateIt.IsAtEnd() || erodeIt.IsAtEnd() ) )
  {
    int value = workIt.Get();
    unsigned char mask = maskIt.Get();
    unsigned char dilate = dilateIt.Get();
    unsigned char erode = erodeIt.Get();
//baut Histogramm auf vom Leberinneren
    if(mask != 0)
    {
      sumIn+=value;
      numIn++;
      histogramm[32768+(int)value]++;
      total++;
    }
//Mittelwert der äußeren Schicht
    if(erode != 0 && mask != 0 )
    {
      sum+=value;
      num++;
      if(value>_max) _max=value;
      if(value<_min) _min=value;
    }
    
    //markiere Leberoberfläche mit -1024 und update bounding box
    if(erode == 0 && dilate != 0 )
    {
      value = -1024;
   
    }
    else if( erode != 0 && mask != 0 )//Leberinneres, behalte Grauwert bei
    {
    
    }
    else//markiere äußeres mit -2048
    {
      value = -2048;
    }
  
    workIt.Set(value);
        
    ++workIt;
    ++maskIt;
    ++dilateIt;
    ++erodeIt;
  }

  VVP_INFO << "liver consists of " << total << " samples.";

  m_GreatestStructureThreshold = GetHistogrammValueFromTop(0.20);
  m_EstimatedThreshold = GetHistogrammValueFromTop(0.10);
  m_MaxThreshold=GetHistogrammValueFromTop(0.001);
  m_MinThreshold=GetHistogrammValueFromBottom(0.20);
  
  VVP_INFO << "threshold range: (" << m_MinThreshold  << ";" << m_MaxThreshold << ") estimated vessel threshold: " << m_EstimatedThreshold ;
  VVP_INFO << "m_GreatestStructureThreshold: " << m_GreatestStructureThreshold;

//  BinImage::Pointer binImageThreshold= Threshold(work,m_GreatestStructureThreshold );
//  LabelImage::Pointer LabelImageunsorted=ConnectComponents(binImageThreshold);
//  LabelImage::Pointer LabelImageSorted= RelabelComponents(LabelImageunsorted);
  

  if(num>0)
    m_realSurfaceValue=sum/num;
  else
    m_realSurfaceValue=0;
    
  if(numIn>0)
    m_realInLiverValue=sumIn/numIn;
  else
    m_realInLiverValue=0;

  m_surfaceValue = _min - 40;
  m_OutOfLiverValue = m_surfaceValue - 40;
  
//  LabelIteratorType labelIt( LabelImageSorted, LabelImageSorted->GetRequestedRegion() );

  workIt.GoToBegin();
//  labelIt.GoToBegin();

  //int numGesetzt=0;
  //int numGelassen=0;
  
  
  while ( ! workIt.IsAtEnd() )
  {
    int value = workIt.Get();
//    int label = labelIt.Get();
    
    if(value == -1024 )
    {
      value = m_surfaceValue;
    }
    else if( value == -2048 )
    {
      value = m_OutOfLiverValue;
    }
    else
    {//innerhalb der Leber
    //Label ungleich 1 -->value auf min setzen
/*
      if (label != 1){
        numGesetzt++;
        value=m_realInLiverValue;
      }
      else
      {
        //value=m_EstimatedThreshold;
        numGelassen++;
      }
  */
    }
  
    workIt.Set(value);
        
    ++workIt;
//    ++labelIt;

  }

  //VVP_INFO << "gesetzt: " << numGesetzt << " --- gelassen: " << numGelassen;
      
  VVP_INFO << "OutOfLiver value: " << m_OutOfLiverValue;
  VVP_INFO << "surface value: " << m_surfaceValue;
  VVP_INFO << "real surface value: " << m_realSurfaceValue;
  VVP_INFO << "real inLiver value:" << m_realInLiverValue;

  work->DisconnectPipeline();
  
  return work;
}
VolumeVisualizationImagePreprocessor::LabelImage::Pointer mitk::VolumeVisualizationImagePreprocessor::ConnectComponents ( BinImage::Pointer  src ) [protected]

Definition at line 150 of file mitkVolumeVisualizationImagePreprocessor.cpp.

References New(), and VVP_INFO.

{
  VVP_INFO << "Connect Components...";

  LabelImage::Pointer dst = LabelImage::New();

  typedef itk::ConnectedComponentImageFilter< BinImage, LabelImage >  myFilterType;
  
  myFilterType::Pointer myFilter = myFilterType::New();
  
  myFilter->SetInput(src);
  myFilter->Update();
  dst = myFilter->GetOutput(); 
  dst->DisconnectPipeline();
  
  return dst;
}
CTImage::Pointer mitk::VolumeVisualizationImagePreprocessor::Crop ( CTImage::Pointer  src ) [protected]

Referenced by Process().

BinImage::Pointer mitk::VolumeVisualizationImagePreprocessor::Crop ( BinImage::Pointer  src ) [protected]
void mitk::VolumeVisualizationImagePreprocessor::DetermineBoundingBox ( BinImage::Pointer  mask ) [protected]

Definition at line 380 of file mitkVolumeVisualizationImagePreprocessor.cpp.

References m_MaxX, m_MaxY, m_MaxZ, m_MinX, m_MinY, m_MinZ, and VVP_INFO.

Referenced by Process().

{
  VVP_INFO << "determining Bounding Box...";
  
  BinIteratorIndexType maskIt( mask, mask->GetRequestedRegion() );

  maskIt.GoToBegin();

  int totalMinX;
  int totalMinY;
  int totalMinZ;

  int totalMaxX;
  int totalMaxY;
  int totalMaxZ;

  // Initialize Bounding Box
  {
    m_MinX=m_MinY=m_MinZ =  1000000;
    m_MaxX=m_MaxY=m_MaxZ = -1000000;    

    totalMinX=totalMinY=totalMinZ =  1000000;
    totalMaxX=totalMaxY=totalMaxZ = -1000000;    
  }

  while ( ! maskIt.IsAtEnd() )
  {
    BinIteratorIndexType::IndexType idx = maskIt.GetIndex();
    int x=idx.GetElement(0);
    int y=idx.GetElement(1);
    int z=idx.GetElement(2);  

    if(x<totalMinX) totalMinX=x;
    if(y<totalMinY) totalMinY=y;
    if(z<totalMinZ) totalMinZ=z;
    
    if(x>totalMaxX) totalMaxX=x;
    if(y>totalMaxY) totalMaxY=y;
    if(z>totalMaxZ) totalMaxZ=z;

    if(maskIt.Get())
    {
      if(x<m_MinX) m_MinX=x;
      if(y<m_MinY) m_MinY=y;
      if(z<m_MinZ) m_MinZ=z;
      
      if(x>m_MaxX) m_MaxX=x;
      if(y>m_MaxY) m_MaxY=y;
      if(z>m_MaxZ) m_MaxZ=z;
    }
    ++maskIt;
  } 
  
  int border = 3;
  
  m_MinX -= border; if(m_MinX < totalMinX ) m_MinX = totalMinX;
  m_MinY -= border; if(m_MinY < totalMinY ) m_MinY = totalMinY;
  m_MinZ -= border; if(m_MinZ < totalMinZ ) m_MinZ = totalMinZ;
  
  m_MaxX += border; if(m_MaxX > totalMaxX ) m_MaxX = totalMaxX;
  m_MaxY += border; if(m_MaxY > totalMaxY ) m_MaxY = totalMaxY;
  m_MaxZ += border; if(m_MaxZ > totalMaxZ ) m_MaxZ = totalMaxZ;
  
  VVP_INFO << "Bounding box" << " m_MinX: " << m_MinX << " m_MaxX: " << m_MaxX
                           << "\n m_MinY: " << m_MinY << " m_MaxY: " << m_MaxY
                           << "\n m_MinZ: " << m_MinZ << " m_MaxZ: " << m_MaxZ;


}
VolumeVisualizationImagePreprocessor::BinImage::Pointer mitk::VolumeVisualizationImagePreprocessor::Dilate ( BinImage::Pointer  src ) [protected]

the original mask is decrease by 1 Voxel

Definition at line 212 of file mitkVolumeVisualizationImagePreprocessor.cpp.

References New(), and VVP_INFO.

Referenced by Process().

{
  VVP_INFO << "Dilating...";

  BinImage::Pointer dst = BinImage::New();

  typedef itk::BinaryDilateImageFilter< BinImage, BinImage,itk::BinaryBallStructuringElement< unsigned char, 3> > BinaryDilateImageType;
  BinaryDilateImageType::KernelType myKernel;
  myKernel.SetRadius(1);
  myKernel.CreateStructuringElement();
  BinaryDilateImageType::Pointer DilateFilter = BinaryDilateImageType::New();
  DilateFilter->SetInput(src);
  DilateFilter->SetKernel(myKernel);  
  DilateFilter->SetDilateValue(1); //to be dilated to 
  DilateFilter->Update();
  dst = DilateFilter->GetOutput(); 
  dst->DisconnectPipeline();
  
  return dst;
}
VolumeVisualizationImagePreprocessor::BinImage::Pointer mitk::VolumeVisualizationImagePreprocessor::Erode ( BinImage::Pointer  src ) [protected]

Definition at line 234 of file mitkVolumeVisualizationImagePreprocessor.cpp.

References New(), and VVP_INFO.

Referenced by Process().

{
  VVP_INFO << "Eroding...";

  BinImage::Pointer dst = BinImage::New();

  typedef itk::BinaryErodeImageFilter< BinImage, BinImage,itk::BinaryBallStructuringElement< unsigned char, 3> > BinaryErodeImageType;
  BinaryErodeImageType::KernelType myKernel;
  myKernel.SetRadius(1);
  myKernel.CreateStructuringElement();
  BinaryErodeImageType::Pointer ErodeFilter = BinaryErodeImageType::New();
  ErodeFilter->SetInput(src);
  ErodeFilter->SetKernel(myKernel);  
  ErodeFilter->SetErodeValue(0); //to be Eroded to 
  ErodeFilter->Update();
  dst = ErodeFilter->GetOutput(); 
  dst->DisconnectPipeline();
  
  return dst;
}
VolumeVisualizationImagePreprocessor::CTImage::Pointer mitk::VolumeVisualizationImagePreprocessor::Gaussian ( CTImage::Pointer  src ) [protected]

Definition at line 257 of file mitkVolumeVisualizationImagePreprocessor.cpp.

References New(), and VVP_INFO.

Referenced by Process().

{
  VVP_INFO << "Gaussian...";

  typedef itk::DiscreteGaussianImageFilter< CTImage, CTImage>                                   GaussianFilterType;

  GaussianFilterType::Pointer gaussianFilter = GaussianFilterType::New();
  gaussianFilter->SetInput( src );
  gaussianFilter->SetVariance( 1 );
  //   gaussianFilter->SetMaximumError( 0.1 );

  gaussianFilter->SetMaximumKernelWidth ( 8 ); 
  gaussianFilter->UpdateLargestPossibleRegion();
  
  CTImage::Pointer dst = gaussianFilter->GetOutput(); 
  dst->DisconnectPipeline();

  return dst;

}
virtual const char* mitk::VolumeVisualizationImagePreprocessor::GetClassName (  ) const [virtual]
double mitk::VolumeVisualizationImagePreprocessor::GetEstimatedThreshold (  ) const [inline]

Definition at line 70 of file mitkVolumeVisualizationImagePreprocessor.h.

  {
    return m_EstimatedThreshold;
  }
int mitk::VolumeVisualizationImagePreprocessor::GetHistogrammValueFromBottom ( double  part ) [protected]

Definition at line 360 of file mitkVolumeVisualizationImagePreprocessor.cpp.

Referenced by Composite().

{
  int unteren = total * part;
  for( int r = -32768 ; r <= 32767 ; r++ )
    if( (unteren -= histogramm[32768+(int)r]) <= 0 )
      return r;
  return 0; // will be never reached
}
int mitk::VolumeVisualizationImagePreprocessor::GetHistogrammValueFromTop ( double  part ) [protected]

Definition at line 370 of file mitkVolumeVisualizationImagePreprocessor.cpp.

Referenced by Composite().

{
  int oberen = total * part;
  for( int r = 32767 ; r >= -32768 ; r-- )
    if( (oberen -= histogramm[32768+(int)r]) <= 0 )
      return r;
  return 0; // will be never reached
}
TransferFunction::Pointer mitk::VolumeVisualizationImagePreprocessor::GetInitialTransferFunction (  )

Definition at line 48 of file mitkVolumeVisualizationImagePreprocessor.cpp.

References m_EstimatedThreshold, m_LastUsedTreshold, m_MaxThreshold, m_OutOfLiverValue, m_realSurfaceValue, m_surfaceValue, New(), and VVP_INFO.

{
  int treshold = m_EstimatedThreshold;

  double opacity = 0.005;

  double maskValue = m_OutOfLiverValue;
  double surfaceValue = m_surfaceValue;
  double realSurfaceValue = m_realSurfaceValue;

  //double surfaceSteepness = 0.0;

  VVP_INFO << "using threshold of " << treshold << " and opacity of " << opacity;

  TransferFunction::Pointer tf = TransferFunction::New();

  // grayvalue->opacity
  {   
    vtkPiecewiseFunction *f=tf->GetScalarOpacityFunction();
    f->RemoveAllPoints();
    f->AddPoint(maskValue,0);
    f->AddPoint(maskValue+1,0);
    f->AddPoint(surfaceValue,0.05);
    f->AddPoint(realSurfaceValue,opacity);
    f->AddPoint(treshold-1,opacity); 
    f->AddPoint(treshold+4,0.8); 
    f->AddPoint(m_MaxThreshold+1,0.8); 
    f->ClampingOn();
    f->Modified();
  }  

  // gradient at grayvalue->opacity
  {  
    vtkPiecewiseFunction *f=tf->GetGradientOpacityFunction();
    f->RemoveAllPoints();
    f->AddPoint( -1000.0, 1.0 );
    f->AddPoint( 1000, 1.0 );
    f->ClampingOn();
    f->Modified();
  }

  // grayvalue->color
  {  
    vtkColorTransferFunction *ctf=tf->GetColorTransferFunction();
    ctf->RemoveAllPoints();
    ctf->AddRGBPoint( maskValue, 0.5, 0.0, 0.0 );
    ctf->AddRGBPoint( maskValue+1, 0.5, 0.0, 0.0 );
    ctf->AddRGBPoint( surfaceValue, 1.0, 0.0, 0.0 ); //0.5
    ctf->AddRGBPoint( realSurfaceValue, 0.2, 0.0, 0.0 );

    ctf->AddRGBPoint( treshold-32, 0.2, 0.0, 0.0 );
    ctf->AddRGBPoint( treshold, 251/255.0, 1.0, 0.0 );
    ctf->AddRGBPoint( m_MaxThreshold+1, 251/255.0, 1.0, 0.0 );

    ctf->ClampingOn();
    ctf->Modified();
  }

  m_LastUsedTreshold = treshold;

  return tf;
}
double mitk::VolumeVisualizationImagePreprocessor::GetLastUsedThreshold (  ) const [inline]

Definition at line 85 of file mitkVolumeVisualizationImagePreprocessor.h.

  {
    return m_LastUsedTreshold;
  }
double mitk::VolumeVisualizationImagePreprocessor::GetMaxThreshold (  ) const [inline]

Definition at line 80 of file mitkVolumeVisualizationImagePreprocessor.h.

  {
    return m_MaxThreshold;
  }
double mitk::VolumeVisualizationImagePreprocessor::GetMinThreshold (  ) const [inline]

Definition at line 75 of file mitkVolumeVisualizationImagePreprocessor.h.

  {
    return m_MinThreshold;
  }
static Pointer mitk::VolumeVisualizationImagePreprocessor::New (  ) [static]
Image::Pointer mitk::VolumeVisualizationImagePreprocessor::Process ( mitk::Image::Pointer  originalCT,
mitk::Image::Pointer  originalLiverMask 
)

Definition at line 620 of file mitkVolumeVisualizationImagePreprocessor.cpp.

References mitk::CastToItkImage(), mitk::CastToMitkImage(), Composite(), Crop(), DetermineBoundingBox(), Dilate(), Erode(), Gaussian(), m_MaxX, m_MaxY, m_MaxZ, m_MinX, m_MinY, m_MinZ, New(), and VVP_INFO.

{
  VVP_INFO << "Processing...";

  // converting mitk image -> itk image
  CTImage::Pointer CTImageWork = CTImage::New();
  CastToItkImage( m_originalCT, CTImageWork );

  // converting mitk image -> itk image
  BinImage::Pointer BinImageMask = BinImage::New();
  CastToItkImage( m_originalLiverMask, BinImageMask );
  
  DetermineBoundingBox( BinImageMask );
  
  if( m_MaxX < m_MinX
   || m_MaxY < m_MinY
   || m_MaxZ < m_MinZ )
    return 0;
  
  CTImageWork = Gaussian(Crop( CTImageWork ));
  BinImageMask = Crop( BinImageMask );

  CTImage::Pointer itkResult =Composite(CTImageWork,BinImageMask,Dilate(BinImageMask),Erode(BinImageMask));

  mitk::Image::Pointer mitkResult= mitk::Image::New();
               mitk::CastToMitkImage( itkResult, mitkResult ); //TODO here we can perhaps save memory

  VVP_INFO << "Finished...";

  return mitkResult;
}
VolumeVisualizationImagePreprocessor::LabelImage::Pointer mitk::VolumeVisualizationImagePreprocessor::RelabelComponents ( LabelImage::Pointer  src ) [protected]

Definition at line 193 of file mitkVolumeVisualizationImagePreprocessor.cpp.

References New(), and VVP_INFO.

{
  VVP_INFO << "Relabeling Components...";

  LabelImage::Pointer dst = LabelImage::New();

  typedef itk::RelabelComponentImageFilter< LabelImage, LabelImage >  myFilterType;
  
  myFilterType::Pointer myFilter = myFilterType::New();
  
  myFilter->SetInput(src);
  myFilter->Update();
  dst = myFilter->GetOutput(); 
  dst->DisconnectPipeline();
  
  return dst;
}
VolumeVisualizationImagePreprocessor::BinImage::Pointer mitk::VolumeVisualizationImagePreprocessor::Threshold ( CTImage::Pointer  src,
int  threshold 
) [protected]

Definition at line 169 of file mitkVolumeVisualizationImagePreprocessor.cpp.

References New(), and VVP_INFO.

{
  VVP_INFO << "thresholding...";

  BinImage::Pointer dst = BinImage::New();

  typedef itk::ThresholdLabelerImageFilter< CTImage, BinImage >  myFilterType;
  
  myFilterType::Pointer myFilter = myFilterType::New();
  
  myFilter->SetInput(src);
  
  myFilterType::ThresholdVector tv;
  tv.push_back(threshold);
  myFilter->SetThresholds(tv);
  
  myFilter->Update();
  dst = myFilter->GetOutput(); 
  dst->DisconnectPipeline();
  
  return dst;
}
void mitk::VolumeVisualizationImagePreprocessor::UpdateTransferFunction ( mitk::TransferFunction::Pointer  tf,
int  treshold 
)

Definition at line 112 of file mitkVolumeVisualizationImagePreprocessor.cpp.

References m_LastUsedTreshold.

{
  double opacity = 0.005;

  //double maskValue = m_OutOfLiverValue;
  //double surfaceValue = m_surfaceValue;
  //double realSurfaceValue = m_realSurfaceValue;

  //double surfaceSteepness = 0.0;

  //VVP_INFO << "changing to threshold of " << treshold << " and opacity of " << opacity;

  // grayvalue->opacity
  {   
    vtkPiecewiseFunction *f=tf->GetScalarOpacityFunction();
    
    f->RemovePoint( m_LastUsedTreshold-1 );
    f->AddPoint(treshold-1,opacity); 
   
    f->RemovePoint( m_LastUsedTreshold+4 );
    f->AddPoint(treshold+4,0.8); 
  }  

  // grayvalue->color
  {  
    vtkColorTransferFunction *ctf=tf->GetColorTransferFunction();

    ctf->RemovePoint( m_LastUsedTreshold-32 );
    ctf->AddRGBPoint( treshold-32, 0.2, 0.0, 0.0 );
    
    ctf->RemovePoint( m_LastUsedTreshold );
    ctf->AddRGBPoint( treshold, 251/255.0, 1.0, 0.0 );
  }

  m_LastUsedTreshold = treshold;
}

Member Data Documentation

Definition at line 171 of file mitkVolumeVisualizationImagePreprocessor.h.

Referenced by Composite().

Definition at line 152 of file mitkVolumeVisualizationImagePreprocessor.h.

Referenced by Composite().

Definition at line 165 of file mitkVolumeVisualizationImagePreprocessor.h.

Referenced by DetermineBoundingBox(), and Process().

Definition at line 166 of file mitkVolumeVisualizationImagePreprocessor.h.

Referenced by DetermineBoundingBox(), and Process().

Definition at line 167 of file mitkVolumeVisualizationImagePreprocessor.h.

Referenced by DetermineBoundingBox(), and Process().

Definition at line 156 of file mitkVolumeVisualizationImagePreprocessor.h.

Referenced by Composite().

Definition at line 161 of file mitkVolumeVisualizationImagePreprocessor.h.

Referenced by DetermineBoundingBox(), and Process().

Definition at line 162 of file mitkVolumeVisualizationImagePreprocessor.h.

Referenced by DetermineBoundingBox(), and Process().

Definition at line 163 of file mitkVolumeVisualizationImagePreprocessor.h.

Referenced by DetermineBoundingBox(), and Process().

Definition at line 147 of file mitkVolumeVisualizationImagePreprocessor.h.

Referenced by Composite().

Definition at line 172 of file mitkVolumeVisualizationImagePreprocessor.h.

Referenced by Composite().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines