[Insight-users] How To Fix that Visualisation ?
circass
circass at gmail.com
Tue Dec 29 04:42:19 EST 2009
This is my Result Volume, but i want to see only the volume pf my dicom
series !
http://img693.imageshack.us/img693/8188/outputo.jpg
As you see it is in a rectangular shape and the volume is not transparent so
nobody can see inside of that volume.
This is my Code :
#include "itkOrientedImage.h"
#include "itkGDCMImageIO.h"
#include "itkGDCMSeriesFileNames.h"
#include "itkImageSeriesReader.h"
#include "itkImageFileWriter.h"
#include "itkCommand.h"
#include "itkImage.h"
#include "itkVTKImageExport.h"
#include "itkOrientedImage.h"
#include "itkGDCMImageIO.h"
#include "itkGDCMSeriesFileNames.h"
#include "itkImageSeriesReader.h"
#include "itkImageFileWriter.h"
#include "itkVTKImageImport.h"
#include "itkCurvatureFlowImageFilter.h"
#include "itkCastImageFilter.h"
#include "itkRGBPixel.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkDICOMImageIO2Factory.h"
#include "itkDICOMImageIO2.h"
#include "itkImageSeriesReader.h"
#include "itkDICOMSeriesFileNames.h"
#include "vtkColorTransferFunction.h"
#include "vtkImageData.h"
#include "vtkImageImport.h"
#include "vtkImageExport.h"
#include "vtkImageActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkVolumeProperty.h"
#include "vtkVolumeTextureMapper.h"
#include "vtkVolumeTextureMapper3D.h"
#include "vtkFixedPointVolumeRayCastMapper.h";
#include "vtkRenderWindowInteractor.h"
#include "vtkInteractorStyleImage.h"
#include "vtkPieceWiseFunction.h"
#include "conio.h"
template <typename ITK_Exporter, typename VTK_Importer>
void ConnectPipelines(ITK_Exporter exporter, VTK_Importer* importer)
{
importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
importer->SetSpacingCallback(exporter->GetSpacingCallback());
importer->SetOriginCallback(exporter->GetOriginCallback());
importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
importer->SetCallbackUserData(exporter->GetCallbackUserData());
}
template <typename VTK_Exporter, typename ITK_Importer>
void ConnectPipelines(VTK_Exporter* exporter, ITK_Importer importer)
{
importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
importer->SetSpacingCallback(exporter->GetSpacingCallback());
importer->SetOriginCallback(exporter->GetOriginCallback());
importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
importer->SetCallbackUserData(exporter->GetCallbackUserData());
}
int main( int argc, char* argv[] )
{
typedef signed short PixelType;
const unsigned int Dimension = 3;
typedef itk::OrientedImage< PixelType, Dimension > ImageType;
typedef itk::ImageSeriesReader< ImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
typedef itk::GDCMImageIO ImageIOType;
ImageIOType::Pointer dicomIO = ImageIOType::New();
reader->SetImageIO( dicomIO );
typedef itk::GDCMSeriesFileNames NamesGeneratorType;
NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();
nameGenerator->SetUseSeriesDetails( true );
nameGenerator->SetDirectory(
"C:\\Users\\circass\\Desktop\\YEDEKLERRRR\\MANIX\\CER-CT\\ANGIO CT" ); //
There are 461 Dicom Image files in it.
std::cout << std::endl << "The directory: " << std::endl;
std::cout << std::endl <<
"C:\\Users\\circass\\Desktop\\YEDEKLERRRR\\MANIX\\CER-CT\\ANGIO CT" <<
std::endl << std::endl;
std::cout << "Contains the following DICOM Series: ";
std::cout << std::endl << std::endl;
typedef std::vector< std::string > SeriesIdContainer;
const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();
SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();
SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();
while( seriesItr != seriesEnd )
{
std::cout << seriesItr->c_str() << std::endl;
seriesItr++;
}
std::string seriesIdentifier;
seriesIdentifier = seriesUID.begin()->c_str();
std::cout << std::endl << std::endl;
std::cout << "Now reading series: " << std::endl << std::endl;
std::cout << seriesIdentifier << std::endl;
std::cout << std::endl << std::endl;
typedef std::vector< std::string > FileNamesContainer;
FileNamesContainer fileNames;
fileNames = nameGenerator->GetFileNames( seriesIdentifier );
reader->SetFileNames( fileNames );
typedef itk::VTKImageExport< ImageType > ExportFilterType;
ExportFilterType::Pointer itkExporter = ExportFilterType::New();
itkExporter->SetInput( reader->GetOutput() );
vtkImageImport* vtkImporter = vtkImageImport::New();
ConnectPipelines(itkExporter, vtkImporter);
typedef itk::VTKImageImport< ImageType > ImportFilterType;
ImportFilterType::Pointer itkImporter = ImportFilterType::New();
vtkImageExport* vtkExporter = vtkImageExport::New();
ConnectPipelines(vtkExporter, itkImporter);
vtkExporter->SetInput( vtkImporter->GetOutput() );
//reader->Update();
vtkPiecewiseFunction* opacityTransferFunction =
vtkPiecewiseFunction::New();
vtkColorTransferFunction* colorTransferFunction =
vtkColorTransferFunction::New();
vtkVolume* volume = vtkVolume::New();
vtkVolumeProperty* volumeProperty = vtkVolumeProperty::New();
vtkVolumeTextureMapper3D* volumeMapper = vtkVolumeTextureMapper3D::New();
vtkFixedPointVolumeRayCastMapper* volumeMapperSoftware =
vtkFixedPointVolumeRayCastMapper::New();
//volumeProperty->SetScalarOpacity(opacityTransferFunction);
volumeProperty->SetInterpolationTypeToNearest();
volumeProperty->ShadeOff();
volume->SetProperty(volumeProperty);
volumeMapperSoftware->SetInput(vtkImporter->GetOutput());
volumeMapperSoftware->SetSampleDistance(0.1);
volume->SetMapper(volumeMapperSoftware);
vtkInteractorStyleTrackballCamera * interactorStyle =
vtkInteractorStyleTrackballCamera::New();
vtkRenderer* renderer = vtkRenderer::New();
vtkRenderWindow* renWin = vtkRenderWindow::New();
renderer->SetBackground(1,1,1);
vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
renWin->SetSize(500, 500);
renWin->AddRenderer(renderer);
iren->SetRenderWindow(renWin);
//iren->SetInteractorStyle(interactorStyle);
renderer->AddVolume(volume);
renWin->Render();
iren->Start();
}
I am developing it in Visual Studio 2008;
my linker -> input files are :
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
comdlg32.lib
advapi32.lib
C:\ITK\Itk-Win\bin\Release\ITKIO.lib
C:\ITK\Itk-Win\bin\Release\ITKNrrdIO.lib
C:\ITK\Itk-Win\bin\Release\itkgdcm.lib
C:\ITK\Itk-Win\bin\Release\itkjpeg12.lib
C:\ITK\Itk-Win\bin\Release\itkjpeg16.lib
C:\ITK\Itk-Win\bin\Release\itkopenjpeg.lib
snmpapi.lib
rpcrt4.lib
C:\ITK\Itk-Win\bin\Release\itkpng.lib
C:\ITK\Itk-Win\bin\Release\itktiff.lib
C:\ITK\Itk-Win\bin\Release\itkjpeg8.lib
C:\ITK\Itk-Win\bin\Release\ITKSpatialObject.lib
C:\ITK\Itk-Win\bin\Release\ITKCommon.lib
C:\ITK\Itk-Win\bin\Release\itkvnl_inst.lib
C:\ITK\Itk-Win\bin\Release\itkvnl_algo.lib
C:\ITK\Itk-Win\bin\Release\itkv3p_netlib.lib
C:\ITK\Itk-Win\bin\Release\itkvnl.lib
C:\ITK\Itk-Win\bin\Release\itkvcl.lib
C:\ITK\Itk-Win\bin\Release\ITKMetaIO.lib
C:\ITK\Itk-Win\bin\Release\itksys.lib
ws2_32.lib
comctl32.lib
wsock32.lib
C:\ITK\Itk-Win\bin\Release\ITKDICOMParser.lib
C:\ITK\Itk-Win\bin\Release\ITKEXPAT.lib
C:\ITK\Itk-Win\bin\Release\ITKniftiio.lib
C:\ITK\Itk-Win\bin\Release\ITKznz.lib
C:\ITK\Itk-Win\bin\Release\itkzlib.lib
C:\ITK\Itk-Win\bin\Release\itkBasicFilters.lib
vtkCommon.lib
vtksqlite.lib
vtkpng.lib
vtktiff.lib
vtkzlib.lib
vtkjpeg.lib
vtkexpat.lib
vtksys.lib
vtkexoIIc.lib
vtkNetCDF.lib
vtkRendering.lib
vtkIO.lib
vtkWidgets.lib
vtkHybrid.lib
vtkGraphics.lib
vtkverdict.lib
vtkImaging.lib
vtkftgl.lib
vtkfreetype.lib
opengl32.lib
vtkFiltering.lib
vtkDICOMParser.lib
vtkmetaio.lib
vtkVolumeRendering.lib
Thanx for your helps
--
View this message in context: http://old.nabble.com/How-To-Fix-that-Visualisation---tp26952729p26952729.html
Sent from the ITK - Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list