From 65a7a4f0820261468adaf4e0bb1f3b501044ea92 Mon Sep 17 00:00:00 2001 From: trillos Date: Mon, 16 Nov 2009 08:55:01 +0000 Subject: [PATCH] Eliminated old versions of transparency --- .../src/bbPackRecalageTransparency.cxx | 167 ------------------ PackRecalage/src/bbPackRecalageTransparency.h | 42 ----- .../src/bbPackRecalageTransparencyV2.cxx | 40 ----- .../src/bbPackRecalageTransparencyV2.h | 43 ----- 4 files changed, 292 deletions(-) delete mode 100644 PackRecalage/src/bbPackRecalageTransparency.cxx delete mode 100644 PackRecalage/src/bbPackRecalageTransparency.h delete mode 100644 PackRecalage/src/bbPackRecalageTransparencyV2.cxx delete mode 100644 PackRecalage/src/bbPackRecalageTransparencyV2.h diff --git a/PackRecalage/src/bbPackRecalageTransparency.cxx b/PackRecalage/src/bbPackRecalageTransparency.cxx deleted file mode 100644 index 3a074a0..0000000 --- a/PackRecalage/src/bbPackRecalageTransparency.cxx +++ /dev/null @@ -1,167 +0,0 @@ -#include "bbPackRecalageTransparency.h" -#include "bbPackRecalagePackage.h" - -#include "vtkCamera.h" -#include "vtkImageActor.h" - -#include -#include -#include - -namespace bbPackRecalage -{ - - class MyTransparencyImage - { - public: - MyTransparencyImage(Transparency* box); - ~MyTransparencyImage(); - - void UpdateView(); - - private: - - //The box to use - Transparency *mBox; - - //Upper image (we apply the lookup table with transparency to this actor) - vtkImageActor *upperImageActor; - - //Base image (not to be modifyed) - vtkImageActor *baseImageActor; - - bool mUpdateCamera; - - }; - - /* - * Constructor - */ - MyTransparencyImage::MyTransparencyImage(Transparency* box) - : - mBox(box) - { - UpdateView(); - } - - /* - * Destructor - */ - MyTransparencyImage::~MyTransparencyImage() - { - //if(newImage != NULL) - { - //newImage->Delete(); - } - } - - /* - * Set image actors and apply lookup table - */ - void MyTransparencyImage::UpdateView() - { - if( ( mBox->bbGetInputImage1() == NULL ) ) - { - mUpdateCamera = true; - } - else if( (mBox->bbGetInputImage1() != NULL) && ( (mBox->bbGetInputStatus("Image1") != bbtk::UPTODATE) ) ) - { - mUpdateCamera = true; - } - if(mUpdateCamera) - { - //Lookup Table - vtkLookupTable *lookup = vtkLookupTable::New(); - lookup->SetAlphaRange(0, 1); - lookup->SetRange(0, 255); - lookup->SetValueRange(0.0, 255); - - //We assign a table of colors for the upper image, and set the white as transparent - for(int i = 0; i < 256; i++) - { - if( i >= 0 && i <= 50 ) - { - lookup->SetTableValue(i, 1.0, 0.0, 1.0, 1); - } - else if( i > 50 && i <= 100 ) - { - lookup->SetTableValue(i, 1.0, 0.0, 0.0, 1); - } - else if( i > 100 && i <= 150 ) - { - lookup->SetTableValue(i, 0.0, 1.0, 0.0, 1); - } - else if( i > 150 && i <= 200 ) - { - lookup->SetTableValue(i, 0.0, 0.0, 1.0, 1); - } - else if( i > 200 && i <= 250 ) - { - lookup->SetTableValue(i, 0.0, 1.0, 1.0, 1); - } - else if( i > 250 && i <= 254) - { - lookup->SetTableValue(i, 1.0, 1.0, 0.0, 1); - } - } - lookup->SetTableValue(255, 1.0, 1.0, 1.0, 0); - - lookup->SetSaturationRange(0.0, 0.0); - lookup->SetRampToLinear( ); - lookup->Build( ); - - vtkImageMapToColors *mapperImage = vtkImageMapToColors::New( ); - mapperImage->SetLookupTable( lookup ); - mapperImage->SetInput( mBox->bbGetInputImage2() ); - mapperImage->SetOutputFormatToRGBA( ); - - upperImageActor = vtkImageActor::New( ); - upperImageActor->SetInput( mapperImage->GetOutput() ); - upperImageActor->SetOpacity( 1 ); - - baseImageActor = vtkImageActor::New( ); - baseImageActor->SetInput( mBox->bbGetInputImage1() ); - - mBox->bbSetOutputActor1( (vtkProp3D*) baseImageActor ); - mBox->bbSetOutputActor2( (vtkProp3D*) upperImageActor ); - - } - } - -BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,Transparency) -BBTK_BLACK_BOX_IMPLEMENTATION(Transparency,bbtk::AtomicBlackBox); -void Transparency::Process() -{ - MyTransparencyImage* trs = new MyTransparencyImage( this ); -} -void Transparency::bbUserSetDefaultValues() -{ - bbSetInputImage1(NULL); - bbSetInputImage2(NULL); - bbSetOutputActor1(NULL); - bbSetOutputActor2(NULL); - -} -void Transparency::bbUserInitializeProcessing() -{ - -// THE INITIALIZATION METHOD BODY : -// Here does nothing -// but this is where you should allocate the internal/output pointers -// if any - - -} -void Transparency::bbUserFinalizeProcessing() -{ - -// THE FINALIZATION METHOD BODY : -// Here does nothing -// but this is where you should desallocate the internal/output pointers -// if any - -} -} -// EO namespace bbPackRecalage - - diff --git a/PackRecalage/src/bbPackRecalageTransparency.h b/PackRecalage/src/bbPackRecalageTransparency.h deleted file mode 100644 index 053b33a..0000000 --- a/PackRecalage/src/bbPackRecalageTransparency.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef __bbPackRecalageTransparency_h_INCLUDED__ -#define __bbPackRecalageTransparency_h_INCLUDED__ -#include "bbPackRecalage_EXPORT.h" -#include "bbtkAtomicBlackBox.h" -#include "iostream" - -#include "vtkImageData.h" -#include "vtkProp3D.h" - -#include "iostream" - -namespace bbPackRecalage -{ - -class bbPackRecalage_EXPORT Transparency - : - public bbtk::AtomicBlackBox -{ - BBTK_BLACK_BOX_INTERFACE(Transparency,bbtk::AtomicBlackBox); - BBTK_DECLARE_INPUT(Image1, vtkImageData*); - BBTK_DECLARE_INPUT(Image2, vtkImageData*); - BBTK_DECLARE_OUTPUT(Actor1, vtkProp3D*); - BBTK_DECLARE_OUTPUT(Actor2, vtkProp3D*); - BBTK_PROCESS(Process); - void Process(); -}; - -BBTK_BEGIN_DESCRIBE_BLACK_BOX(Transparency,bbtk::AtomicBlackBox); -BBTK_NAME("Transparency"); -BBTK_AUTHOR("c.perez75@uniandes.edu.co"); -BBTK_DESCRIPTION("Superposition of 2 images using transparency"); -BBTK_CATEGORY("__CATEGORY__"); -BBTK_INPUT(Transparency, Image1, "Input Image1", vtkImageData*, ""); -BBTK_INPUT(Transparency, Image2, "Input Image2", vtkImageData*, ""); -BBTK_OUTPUT(Transparency, Actor1, "Base image actor", vtkProp3D*, ""); -BBTK_OUTPUT(Transparency, Actor2, "Upper image actor", vtkProp3D*, ""); -BBTK_END_DESCRIBE_BLACK_BOX(Transparency); -} -// EO namespace bbPackRecalage - -#endif // __bbPackRecalageTransparency_h_INCLUDED__ - diff --git a/PackRecalage/src/bbPackRecalageTransparencyV2.cxx b/PackRecalage/src/bbPackRecalageTransparencyV2.cxx deleted file mode 100644 index e380128..0000000 --- a/PackRecalage/src/bbPackRecalageTransparencyV2.cxx +++ /dev/null @@ -1,40 +0,0 @@ -#include "bbPackRecalageTransparencyV2.h" -#include "bbPackRecalagePackage.h" -namespace bbPackRecalage -{ - -BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,TransparencyV2) -BBTK_BLACK_BOX_IMPLEMENTATION(TransparencyV2,bbtk::AtomicBlackBox); -void TransparencyV2::Process() -{ - transparency->setImage1(bbGetInputIn1()); - transparency->setImage2(bbGetInputIn2()); - transparency->setPercent(bbGetInputPercent()); - transparency->calculateImage(); - - bbSetOutputOut(transparency->getImage()); -} -void TransparencyV2::bbUserSetDefaultValues() -{ - bbSetInputIn1(NULL); - bbSetInputIn2(NULL); - bbSetInputPercent(-1); - bbSetOutputOut(NULL); -} -void TransparencyV2::bbUserInitializeProcessing() -{ - transparency = new Transparency(); -} -void TransparencyV2::bbUserFinalizeProcessing() -{ - -// THE FINALIZATION METHOD BODY : -// Here does nothing -// but this is where you should desallocate the internal/output pointers -// if any - -} -} -// EO namespace bbPackRecalage - - diff --git a/PackRecalage/src/bbPackRecalageTransparencyV2.h b/PackRecalage/src/bbPackRecalageTransparencyV2.h deleted file mode 100644 index 1d4c751..0000000 --- a/PackRecalage/src/bbPackRecalageTransparencyV2.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __bbPackRecalageTransparencyV2_h_INCLUDED__ -#define __bbPackRecalageTransparencyV2_h_INCLUDED__ -#include "bbPackRecalage_EXPORT.h" -#include "bbtkAtomicBlackBox.h" -#include "iostream" - -#include "vtkImageData.h" -#include "Transparency.h" - -namespace bbPackRecalage -{ - -class bbPackRecalage_EXPORT TransparencyV2 - : - public bbtk::AtomicBlackBox -{ - BBTK_BLACK_BOX_INTERFACE(TransparencyV2,bbtk::AtomicBlackBox); - BBTK_DECLARE_INPUT(In1,vtkImageData*); - BBTK_DECLARE_INPUT(In2,vtkImageData*); - BBTK_DECLARE_INPUT(Percent,int); - BBTK_DECLARE_OUTPUT(Out,vtkImageData*); - BBTK_PROCESS(Process); - void Process(); - - private: - Transparency *transparency; -}; - -BBTK_BEGIN_DESCRIBE_BLACK_BOX(TransparencyV2,bbtk::AtomicBlackBox); -BBTK_NAME("TransparencyV2"); -BBTK_AUTHOR("jn.trillos44@uniandes.edu.co"); -BBTK_DESCRIPTION("Second version of a transparency algorithm"); -BBTK_CATEGORY("__CATEGORY__"); -BBTK_INPUT(TransparencyV2,In1,"First image for transparency",vtkImageData*,""); -BBTK_INPUT(TransparencyV2,In2,"Second image for transparency",vtkImageData*,""); -BBTK_INPUT(TransparencyV2,Percent,"Percent of transparency for the second image",int,""); -BBTK_OUTPUT(TransparencyV2,Out,"First output",vtkImageData*,""); -BBTK_END_DESCRIBE_BLACK_BOX(TransparencyV2); -} -// EO namespace bbPackRecalage - -#endif // __bbPackRecalageTransparencyV2_h_INCLUDED__ - -- 2.45.0