itk-wasm icon indicating copy to clipboard operation
itk-wasm copied to clipboard

Load bad dicom tag spacing when uses in a server

Open laurennlam opened this issue 2 years ago • 3 comments

I have a simple code to load only one dcm file. The main issue is that it perfectly works locally, but when it's deployed on a server, then the spacing is not the correct one. Instead of loading dicom tag PixelSpacing (0028, 0030), it loads ImagePixelSpacer (0018, 1164). The code is exactly the same. I compiled a bundle.js locally and then, use it in the server. vtk.js/itk.js version are same:

  • vtk.js: 14.15.7
  • itk.js: 13.1.3 (same issue when I upgrade to the latest version)
import readImageFile from 'itk/readImageFile';
import vtkITKHelper from 'vtk.js/Sources/Common/DataModel/ITKHelper'

static LoadImageFile(path) {
		return new Promise((resolve, reject)=> {
			var xhr = new XMLHttpRequest();
			xhr.open("GET", path);
			xhr.responseType = "blob";
			xhr.addEventListener('load', function() {
				const file = xhr.response;
				file.lastModifiedDate = new Date();
				file.name = 'file';
				readImageFile(null, file)
					.then(({ image: itkImage, webWorker }) => {
						webWorker.terminate()
						const imageData = vtkITKHelper.convertItkToVtkImage(itkImage)
                                                // Here, the spacing of the imageData is not correct
						resolve(itkImage)
					})
					.catch(error => {
						reject(error)
					})
			});
			xhr.send();
		});
	}

Thanks for your help. @finetjul

laurennlam avatar Jan 12 '22 13:01 laurennlam

Please try the latest itk-wasm :-)

thewtex avatar Jan 20 '22 21:01 thewtex

@thewtex Sorry but how can we try it when there is no documentation

stounej avatar Jan 26 '22 15:01 stounej

@stounej There is documentation. If there is something missing, then create a helpful issue with specifics.

thewtex avatar Jan 27 '22 01:01 thewtex