From 978547d211ab51dfd9c428490596246a42ac930f Mon Sep 17 00:00:00 2001 From: Christian Askeland Date: Tue, 6 Oct 2015 13:55:26 +0200 Subject: [PATCH] BUG: #54 Color not supported in vtkImageData->igtl::ImageMessage. Fixed by adding NumComponents --- MRML/vtkIGTLToMRMLImage.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MRML/vtkIGTLToMRMLImage.cxx b/MRML/vtkIGTLToMRMLImage.cxx index 7188721..725b936 100644 --- a/MRML/vtkIGTLToMRMLImage.cxx +++ b/MRML/vtkIGTLToMRMLImage.cxx @@ -580,12 +580,12 @@ int vtkIGTLToMRMLImage::MRMLToIGTL(unsigned long event, vtkMRMLNode* mrmlNode, i int scalarType; // scalar type //double *origin; double *spacing; // spacing (mm/pixel) - //int ncomp; + int ncomp; int svoffset[] = {0, 0, 0}; // sub-volume offset int endian; scalarType = imageData->GetScalarType(); - //ncomp = imageData->GetNumberOfScalarComponents(); + ncomp = imageData->GetNumberOfScalarComponents(); imageData->GetDimensions(isize); //imageData->GetExtent(0, isize[0]-1, 0, isize[1]-1, 0, isize[2]-1); //origin = imageData->GetOrigin(); @@ -608,6 +608,7 @@ int vtkIGTLToMRMLImage::MRMLToIGTL(unsigned long event, vtkMRMLNode* mrmlNode, i this->OutImageMessage->SetEndian(endian); this->OutImageMessage->SetDeviceName(volumeNode->GetName()); this->OutImageMessage->SetSubVolume(isize, svoffset); + this->OutImageMessage->SetNumComponents(ncomp); this->OutImageMessage->AllocateScalars(); memcpy(this->OutImageMessage->GetScalarPointer(),