I have a custom loadable modul. In this modul, I want to apply IKT or VTK filters on the previously loaded DICOM volume. I have something like this:
vtkMRMLVolumeNode* volumeNode = d->MRMLVolumeNode; // this contains the loaded DICOM volume
vtkImageData* imageData = volumeNode->GetImageData(); //now I have the image data of that volume
I think I missed something from here because assertation happens during debug in the Update() function gaussianSmoothFilter->Update();
Maybe I missed the gaussianSmoothFilter->SetInputConnection(...) function call before the Update(), but how can I get the proper input for this function? I have only the volumeNode objectâŚ
But now letâs assume that the filtered pointer holds the Gaussian filtered image: vtkImageData* filtered = gaussianSmoothFilter->GetOutput();
My question is, how can I display this volume in the slice viewes?
(Example codes are highly appreciated.)
For applying ITK and VTK filters, you donât need to develop C++ loadable modules. The simplest is to use Python scripted modules or CLI modules. There are lots of examples for various module types in the Slicer core.
This one causes exception in Update(): gaussianSmoothFilter->SetInputData(volumeNode->GetImageData());
but this is okay and works well: gaussianSmoothFilter->SetInputConnection( volumeNode->GetImageDataConnection() );
Hi Andras,
Would you please tell me what I am doing wrong in the code below:
I need to apply normalize image filter of simple filters to volume.
normal = vtk.vtkImageNormalize()
normal.SetInputData(volumeNode.GetImageData())
normal.Update()
volumeNode.SetImageData(normal.GetOutput())
Error:
Traceback (most recent call last): File â<string>â, line 8, in <module> AttributeError: âMRMLCorePython.vtkMRMLScalarVolumeNodeâ object has no attribute âSetImageDataâ
I got the results with below but its not showing correct results when compared to results obtained using slicer APP. is this the correct filter for normalize image filter?
normal = vtk.vtkImageNormalize()
normal.SetInputConnection(volumeNode.GetImageDataConnection())
normal.Update()
volumeNode.SetImageDataConnection(normal.GetOutputPort())
What do you expect this filter would do? What happens instead?
How did you obtain the good results that you mentioned?
Why would you like to normalize an image?
Applying linear intensity scaling will most likely not affect automatic segmentation results. Even the most basic methods are insensitive to global image brightness/contrast adjustments.
Check out segmentation tutorials and read these posts to have an idea how you can segment semi-automatically or automatically in Slicer:
Fully automatic segmentation is probably not the best approach, but you can get very close to it (probably 1-2 minutes of userâs time) if you implement a custom script:
brain: you can use SwissSkullStripper extension to get the brain completely automatically
ventricles: probably you can get ventricles by thresholding in brain segment region, potentially with some pre/post processing for optimal results
tumor: there is a large variety of their size, location, and appearance, so fully automatic detection may be very difficult; however, you should be able to segment a tumor within one minute, with minimal user input, using âGrow from seedsâ effect
Does the swiss skull stripper always use the atlas image and atlas mask. Is it reliable to use the same mask and image for any mri for extracting brain.
Yes, CreateLabelVolumeFromVolume method converts a scalar volume to a label volume. However, in your full script you used CreateAndAddLabelVolume method, which creates an empty label volume based on geometry specified by another volume.
The simplest is to load the label volume with the correct loading function: slicer.util.loadLabelVolume() - then you donât need any conversion.
Hi Andras,
Could you please share the ventricle segmentation tutorial so I can get the idea of workflow and write the script for ventricle extraction. It can be done automatically through script calling modules. right?
I was using threshold and island effect but island effect require user input which I do not want.