Rename nodes with python script

Hello. I have a question. Currently, I am loading more than 10 MRI series per patient, each acquired on different dates, and measuring volumes. However, the node names are inconsistent, and I would like to rename them in chronological order using the date information from DICOM files. I believe I can achieve this by accessing the Python script. Could you provide how to approach this? I’ve also searched through Python script repositories but couldn’t find a solution.

You can do something like this example:

Iterate through the studies for the patient and query the StudyData using the slicer.dicomDatabase.fileValue method to get the data to sort the data. You can load the series you want and use SetName to provide a consistent convention. You may need some special case code to deal with the variability in clinical naming conventions.

Thanks for the quick response. I have one more question. Can I perform 3D Slicer tasks using Spyder with Python? I want to use Spyder instead of the Python console.

People have done things like that - you can search for it. I didn’t find it worth the effort but if you have good luck please report back.