I have the following function in Java<div><br></div><div><div>public vtkImageData getBlankBinaryImage() {</div><div> vtkImageData image = ENV.getInstance().getDataLoader().getImage();</div><div> vtkImageData blankImage = new vtkImageData();</div>
<div> // Because of a bug in vtk, where the contour widget doesn't work if</div><div> // the ROI goes all the way to the edge of the image, we're going to</div><div> // increase the size of the image by 1 in each direction to take care</div>
<div> // of this</div><div> int[] extent = image.GetExtent();</div><div> extent[1]+=2;</div><div> extent[3]+=2;</div><div> extent[5]+=2;</div><div> double[] origin = image.GetOrigin();</div>
<div> double[] spacing = image.GetSpacing();</div><div> blankImage.SetExtent(extent);</div><div> blankImage.SetOrigin(origin);</div><div> blankImage.SetSpacing(spacing);</div><div> blankImage.SetScalarTypeToUnsignedChar();</div>
<div> blankImage.AllocateScalars();</div><div> return blankImage;</div><div> }</div></div><div><br></div><div>My goal is to return a vtkImageData where all of the voxels are set to 0. On Windows this works fine, however, on Mac this doesn't. How can I ensure that all voxels have a value of 0 on any platform?</div>
<div><br></div><div>Thanks.</div>