return false;
}
}
- std::cout << "Selecting : "<<node->ImageGetFullFileName() << std::endl;
+ // std::cout << "Selecting : "<<node->ImageGetFullFileName() << std::endl;
return true;
}
//================================================================
{
// n2D to 3D
vtkImageData* out = vtkImageData::New();
- out->CopyStructure(first);
+ out->CopyStructure(first);
+ out->SetScalarType(first->GetScalarType());
int ext[6];
first->GetExtent(ext);
ext[5] = im.size();
out->SetExtent(ext);
+ // LG : TODO : Z Spacing ?
out->AllocateScalars();
- out->Print(std::cout);
+
+ //first->Print(std::cout);
+ // out->Print(std::cout);
int dim[3];
first->GetDimensions(dim);
( (unsigned long)first->GetScalarPointer(0,1,0)
- (unsigned long)first->GetScalarPointer(0,0,0))
*dim[1];
- std::cout << "imsize="<<imsize<<std::endl;
int slice = 0;
std::vector<DicomNode*>::iterator it;
for (it=im.begin(); it!=im.end(); ++it)
{
+ //std::cout << "copying slice "<<slice <<std::endl;
vtkImageData* cur = mReader.GetImage( (*it)->ImageGetFullFileName() );
void* src = cur->GetScalarPointer(0,0,0);
void* dst = out->GetScalarPointer(0,0,slice);
+ // std::cout << "src="<<src<<std::endl;
+ // std::cout << "dst="<<dst<<std::endl;
+ // std::cout << "siz="<<imsize<<std::endl;
memcpy(dst,src,imsize);
+
+ /*
+ // verif
+ int ii,jj;
+ for (ii=1;ii<4;ii++) {
+ for (jj=1;jj<4;jj++) {
+ int x = (int)(ii*dim[0] / 4);
+ int y = (int)(jj*dim[1] / 4);
+ std::cout << cur->GetScalarComponentAsFloat(x,y,0,0)
+ << " vs "
+ << out->GetScalarComponentAsFloat(x,y,slice,0)
+ << std::endl;
+ }
+ }
+ */
+
slice++;
}
f.push_back(out);