question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unhandled Rejection (TypeError): Cannot read property 'getRange' of null

See original GitHub issue

hello.

I extracted the vti from the dicom file series using the following Python code:

def vtkImageToNumPy(image, pixelDims):
    imageData = reader.GetOutput()
    pointData = image.GetPointData()
    arrayData = pointData.GetArray(0)
    ArrayDicom = numpy_support.vtk_to_numpy(arrayData)
    ArrayDicom = ArrayDicom.reshape(pixelDims, order='F')

    return ArrayDicom

dicomFolder = "./lung_imgs"
reader = vtk.vtkDICOMImageReader()
reader.SetDirectoryName(dicomFolder)
reader.Update()

# Load dimensions using `GetDataExtent`
my_extent = reader.GetDataExtent()
ConstPixelDims = [my_extent[1]-my_extent[0]+1, my_extent[3]-my_extent[2]+1, my_extent[5]-my_extent[4]+1]

# Load spacing values
ConstPixelSpacing = reader.GetPixelSpacing()

dicom_array = vtkImageToNumPy(reader.GetOutput(), ConstPixelDims)

from pyevtk.hl import imageToVTK

imageToVTK("./lungResult",cellData={"ArrayDicom" : dicom_array})

So I tried to implement volume rendering. However, the following error occurred:

image

So I tried to compare the implemented vti file with the unimplemented vti file through the para view. There were the following differences:

[unimplemented]

image

[implemented]

image

I want to find the difference and solution between the above pictures. I would like to implement volume rendering using ArrayDicom.

I would really appreciate your reply.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12

github_iconTop GitHub Comments

4reactions
jourdaincommented, May 2, 2019

I thing VolumeRendering expect Scalars unless you specify which array you want to look at.

Anyway a way to fix that is to locally set that array as scalars

const pd = imageData.getPointData();
pd.setScalars(pd.getArray(0));
3reactions
jourdaincommented, Apr 30, 2019

Probably because you don’t have Scalars (active array). You can try imageData.getPointData().getArray(0) instead of getScalars().

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'getRange' of null [duplicate]
The error Cannot read property 'getRange' of null means that the script cannot find the specified range; The most common reason of this ......
Read more >
Cannot read property "getRange" from null. (line 3, file "Code"
I am getting a Cannot read property "getRange" from null. (line3, file "Code"). var emailRange = SpreadsheetApp. getActiveSpreadsheet().
Read more >
Cannot read property 'getRange' of null (line 106, file "Code")
Whenever I try to run this code it gives me the following error: TypeError: Cannot read property 'getRange' of null (line 106, file...
Read more >
ERROR TypeError: Cannot read property title of undefined
Solved C# Empty String if null System.NullReferenceException: Object reference not set to instance. CodeDocu Developer C# Asp Net Angular.
Read more >
Fix Cannot Set Property of Null Error in JavaScript - YouTube
Check us out at https://www.skillforge.com The " cannot set property of null " error is a very common JavaScript issue that you may...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found