bool mitkSegmentationInterpolationTestClass::ClearSegmentation() { int* p = (int*)m_Image->GetData(); // pointer to pixel data int size = dim[0]*dim[1]*dim[2]; for(int i=0; i<size; ++i, ++p) *p=0; // fill image with zeros return true; }
/** * Creates a square segmentation in slices 0 and 2. */ bool mitkSegmentationInterpolationTestClass::CreateTwoSlices(int slicedim) { int* p = (int*)m_Image->GetData(); // pointer to pixel data int size = dim[0]*dim[1]*dim[2]; for(int i=0; i<size; ++i, ++p) { int x,y,z; int xdim,ydim; switch (slicedim) { case 0: z = i % dim[0]; y = i / dim[0] % dim[1]; x = i / (dim[1]*dim[0]); xdim = 2; ydim = 1; break; case 1: x = i % dim[0]; z = i / dim[0] % dim[1]; y = i / (dim[1]*dim[0]); xdim = 0; ydim = 2; break; case 2: default: x = i % dim[0]; y = i / dim[0] % dim[1]; z = i / (dim[1]*dim[0]); xdim = 0; ydim = 1; break; } if ( ((z == 0) || (z == 2)) && (x >= pad[xdim]) && (x < ( (signed) dim[xdim]-pad[xdim])) && (y >= pad[ydim]) && (y < ( (signed) dim[ydim]-pad[ydim])) ) { *p = 1; } else { *p = 0; } } m_Interpolator->SetSegmentationVolume( m_Image ); std::cout << " (II) SetSegmentationVolume works (slicedim " << slicedim << ")" << std::endl; return true; }
mitk::USImage::USImage(mitk::Image::Pointer image) : mitk::Image() { this->Initialize(image); this->SetVolume(image->GetData()); }