I have been playing around with my MicroCT DCM files and exporting them as NRRD files. I need them to eventually use in shapeworks. Before using the smoothing filters, the full bone shape showed up fine on shapeworks. However, shapeworks will not preform the correct analyzes unless the shape is smoothed. I used the smoothing filter with Gaussian (as the rest of the options lead the program to crash) and when I upload the nrrd file into shapeworks, it now only shows a hollow shape of the bone, with no top or bottom layer. Has anyone had this problem?
It is not clear where you are doing your image processing prior to ShapeWorks. If it is in Slicer, you should be able to visualize what the bone looks like after smoothing (also it is not clear to me whether you are running the smoothing on the intensity data or a labelmap) and trace down where the issue is coming from.
These are the steps I took to process the data. First, I uploaded my DCM data. Then I used the drawing tool to create outlines of multiple layers of the bones, including first and last layer. I attached that image below. After this point, I used the fill between slices tool to create a full 3D image of the bone. I lastly used the Gaussian smoothing tool with 3.00 mm to smooth the bone. After exporting this as an nrrd labelmap, I tried uploading to shape works, which is where I gained the imagine below.
Other steps I have taken to try to process my data is by uploading the dcm files and by using the threshold tool to create a 3D image of the bone. However, this leave many inconsistencies and holes in the bone. I tried using the Gaussian smoothing tool to smooth it, but it makes the bone fully disappear. If I use any other smoothing tool (median, opening, closing, etc), slicer crashes.
Can you share your dicom dataset? I am not sure why you are manually tracing the outlines as you have done in the screenshot? It is too much work, and prone to errors as you have encountered.
I used the method of tracing multiple slices and interpolating between them in order to create a smooth bone. In order to properly analyze the bone in shapeworks, the bone must be smooth and not have many holes/inconsistencies, which is the case with the threshold tool. 001 DCM Files.zip
You can easily use existing tools in segment editor to create a cortical bone outline with a combintation of threshold effect, dilate/erode, shrink/expand and logical operators. (see the screenshot below).
You get a hollow surface, that because thatâs what you have.
If you need the surface to be capped, you need to expand the dimensions of your Volume (i.e., you need to 0 pad), and manually fill the very top and bottom slices. This is doable with the CropVolume module, just expand the ROI slightly in all three views.
When you are running smoothing filters, you need to be mindful of the voxel spacing. if you ran like 5mm kernel size (which is 83x83x83 voxels for your dataset), it is likely it will crash because of the memory consumption. For your dataset meaningful kernel size would be about 0.1-0.5mm
Thanks so much for your help. I have one more question for you. Most of my DCM files are right tibias, but I have a few left ones. I would like to mirror the 3D volume to match the right tibia. I tried this by exporting the volume as an STL file, then using the surface toolbox module to mirror the volume, then exporting the mirrored stl file back to an nrrd labelmap. However, this led to an error in exporting the NRRD file. I canât find any other way online for how to properly mirror the image. Can you help?
OK. I can repllicate this error with your dataset. Not sure why.
Also I tried with the MRHead, while it doesnât generate an error, it doesnât mirror the image either.
This is a question for developers @lassoan@pieper@jcfr. this is the full log starting with DICOM import
Switch to module: "DICOM"
['C:/Users/murat/AppData/Local/NA-MIC/Slicer 5.2.2/NA-MIC/Extensions-31382/SlicerDcm2nii/lib/Slicer-5.2/qt-scripted-modules\\Resources\\bin\\dcm2niix', '-n', '-1', '-s', 'y', '-f', '%p_%t_%s', '-i', 'y', '-o', 'C:/Users/murat/AppData/Local/Temp/Slicer\\tmpp8_s0f2l', 'C:/Users/murat/AppData/Local/Temp/Slicer\\tmpp8_s0f2l\\input-dicom-files.txt']
Chris Rorden's dcm2niiX version v1.0.20230210 (JP2:OpenJPEG) (JP-LS:CharLS) MSC1930 (64-bit Windows)
Found 168 files in 'C:/Users/murat/AppData/Local/Temp/Slicer\tmpp8_s0f2l\input-dicom-files.txt'
Found 168 DICOM file(s)
Warning: PatientOrient (0018,5100) not specified (issue 642).
Warning: Unable to determine manufacturer (0008,0070), so conversion is not tuned for vendor.
1764499720 C:/Users/murat/AppData/Local/Temp/Slicer\tmpp8_s0f2l\Linear_Attenuation_[1_cm]_(3035)_20221027122619_3035
C:/Users/murat/Downloads/dicoms/C0002716_00000.DCM
Conversion required 0.259000 seconds.
Loading with imageIOName: GDCM
WARNING: In D:\D\S\S-0-build\ITK\Modules\IO\ImageBase\include\itkImageSeriesReader.hxx, line 478
ImageSeriesReader (00000228A88989E0): Non uniform sampling or missing slices detected, maximum nonuniformity:9.64072e-05
Irregular volume geometry detected, but maximum error is within tolerance (maximum error of 5.32934e-05 mm, tolerance threshold is 0.001 mm).
Switch to module: "Data"
Switch to module: "Volumes"
Switch to module: "SimpleFilters"
myFilter = FlipImageFilter()
myFilter.SetDebug(False)
myFilter.SetFlipAboutOrigin(False)
myFilter.SetFlipAxes((True, False, False))
myFilter.SetNumberOfThreads(16)
myFilter.SetNumberOfWorkUnits(0)
slicer.util.MRMLNodeNotFoundeException is due to Simple Filters module cannot deal with special characters in the filename. The problem is that it seems to look up nodes by name.
A workaround is to rename the image (e.g., 3035: Linear Attenuation [1-cm] (3035) to 3035: Linear Attenuation).
Mirroring of an image is a very risky operation (may lead to âwrong sideâ mistakes), so it is rarely done and has not been made easily accessible. FlipImageFilter works well, but it just flips the voxel order in memory, but keeps the physical position of the voxels unchanged.You can see the difference in the IJK to RAS direction matrix in Volumes module / Information.
If you want to physically flip the image then after you apply the FlipImageFilter, you also need to apply and harden a mirroring transformation matrix (eâŚg, diagonal of [-1, 1, 1, 1]). You need the FlipImageFilter because without that the transform would make the volumeâs IJK coordinate system a left-handed coordinate system, which may lead to problems (for example, Iâm not sure if NIFTI can store images that use a left-handed voxel coordinate system; models that are generated from such inverted images may have inverted normals, âŚ).
Thank you for your help. I only need the image to be flipped to compare geometry to other images. I had success with your method, however attached is an image of how the bone shows up in 3D. I am wondering why this is the case and if it would cause any issues when opening up the nrrd file in shapeworks?
Hi, sorry about that. The box around the bone is way larger than the bone itself, and it is making it so the bone does not show up on shapeworks when I upload it