Splitting 4D NRRD Files?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Splitting 4D NRRD Files?

Beers, Andrew Lawrence

Hello all!

 

I’ve recently been loading some 4D volumes from DICOM into Multivolume NRRD files. This has worked well with the multivolume explorer, but I would like to split these multivolumes into different individual 3D volumes at each time point for some other processing. Does anyone know of any tool or scripting functionality within Slicer that I could use to split up these 4D multivolumes into a group of individual files?

 

Thanks for your help,

Andrew

(MGH)


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Splitting 4D NRRD Files?

Anthony Gatti
Hi Andrew, 

I wrote a small module for Slicer to do something similar. The folder with the program is attached. If you follow the instructions under “Developing and contributing extensions for 3D slicer” at link [1] you can follow for the first 11 slides and then put this folder in your MySlicerExtensions folder. This will then allow you to load this module, it will be in your modules dropdown under 'Gatti'. You can follow the rest of the tutorial to learn a bit more if you want. I created the program to extract the first echo of a multi echo MRI acquisition. If you want to extract something other than the first dimension you will want to change the number on line 123 of the python code (multi2SingleVolume.py) from 0 (1st echo) to the corresponding value that you want to extract (this is within the folder). Once the module is open, on the input volume drop down menu select your 4D image, in the other one just create a new volume, this was a dummy and actually doesn’t do anything. Once you click apply, the program will create a new volume of just the 1st echo, or whatever you change line 123 to. 

Alternatively, and probably easier, I’ve attached some of the code from that module and altered slightly (create3DFrom4D.py). Open the python module in slicer and input the below code when the 4D image of interest is open in slicer. Before doing so, replace the star on line 2 with your filename, and you can replace the number (1) on line 3 with what slice of the 4th dimension you want to extract. This will create a new volume that is named based on the filename of the original and the slice of the 4th dimension used. 

If anyone sees any issues with this please feel free to chime in. 

Hope that helps, 

Anthony. 






On Aug 10, 2016, at 6:25 PM, Beers, Andrew Lawrence <[hidden email]> wrote:

Hello all!
 
I’ve recently been loading some 4D volumes from DICOM into Multivolume NRRD files. This has worked well with the multivolume explorer, but I would like to split these multivolumes into different individual 3D volumes at each time point for some other processing. Does anyone know of any tool or scripting functionality within Slicer that I could use to split up these 4D multivolumes into a group of individual files?
 
Thanks for your help,
Andrew
(MGH)
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

Multi2SingleVolume.zip (226K) Download Attachment
create3DFrom4D.py (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Splitting 4D NRRD Files?

Beers, Andrew Lawrence
In reply to this post by Beers, Andrew Lawrence

Your code works great! I’ve only tested the code segment you attached and not yet the extension, but it perfectly solves the problem I was having. I’ll test the extension soon and tell you if I see any issues. Thanks so much for your help.

 

Best,

Andrew

 

From: Anthony Gatti [mailto:[hidden email]]
Sent: Wednesday, August 10, 2016 10:03 PM
To: Beers, Andrew Lawrence
Cc: SPL Slicer Users
Subject: Re: [slicer-users] Splitting 4D NRRD Files?

 

Hi Andrew, 

 

I wrote a small module for Slicer to do something similar. The folder with the program is attached. If you follow the instructions under “Developing and contributing extensions for 3D slicer” at link [1] you can follow for the first 11 slides and then put this folder in your MySlicerExtensions folder. This will then allow you to load this module, it will be in your modules dropdown under 'Gatti'. You can follow the rest of the tutorial to learn a bit more if you want. I created the program to extract the first echo of a multi echo MRI acquisition. If you want to extract something other than the first dimension you will want to change the number on line 123 of the python code (multi2SingleVolume.py) from 0 (1st echo) to the corresponding value that you want to extract (this is within the folder). Once the module is open, on the input volume drop down menu select your 4D image, in the other one just create a new volume, this was a dummy and actually doesn’t do anything. Once you click apply, the program will create a new volume of just the 1st echo, or whatever you change line 123 to. 

 

Alternatively, and probably easier, I’ve attached some of the code from that module and altered slightly (create3DFrom4D.py). Open the python module in slicer and input the below code when the 4D image of interest is open in slicer. Before doing so, replace the star on line 2 with your filename, and you can replace the number (1) on line 3 with what slice of the 4th dimension you want to extract. This will create a new volume that is named based on the filename of the original and the slice of the 4th dimension used. 

 

If anyone sees any issues with this please feel free to chime in. 

 

Hope that helps, 

 

Anthony. 

 

 

 

 

 

 

On Aug 10, 2016, at 6:25 PM, Beers, Andrew Lawrence <[hidden email]> wrote:

 

Hello all!

 

I’ve recently been loading some 4D volumes from DICOM into Multivolume NRRD files. This has worked well with the multivolume explorer, but I would like to split these multivolumes into different individual 3D volumes at each time point for some other processing. Does anyone know of any tool or scripting functionality within Slicer that I could use to split up these 4D multivolumes into a group of individual files?

 

Thanks for your help,

Andrew

(MGH)

_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to 
[hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Splitting 4D NRRD Files?

Andrey Fedorov-2

There is a helper function here to do this operation

https://github.com/fedorov/MultiVolumeExplorer/blob/master/Util/helpers.py


On Aug 11, 2016 12:16 PM, "Beers, Andrew Lawrence" <[hidden email]> wrote:

Your code works great! I’ve only tested the code segment you attached and not yet the extension, but it perfectly solves the problem I was having. I’ll test the extension soon and tell you if I see any issues. Thanks so much for your help.

 

Best,

Andrew

 

From: Anthony Gatti [mailto:[hidden email]]
Sent: Wednesday, August 10, 2016 10:03 PM
To: Beers, Andrew Lawrence
Cc: SPL Slicer Users
Subject: Re: [slicer-users] Splitting 4D NRRD Files?

 

Hi Andrew, 

 

I wrote a small module for Slicer to do something similar. The folder with the program is attached. If you follow the instructions under “Developing and contributing extensions for 3D slicer” at link [1] you can follow for the first 11 slides and then put this folder in your MySlicerExtensions folder. This will then allow you to load this module, it will be in your modules dropdown under 'Gatti'. You can follow the rest of the tutorial to learn a bit more if you want. I created the program to extract the first echo of a multi echo MRI acquisition. If you want to extract something other than the first dimension you will want to change the number on line 123 of the python code (multi2SingleVolume.py) from 0 (1st echo) to the corresponding value that you want to extract (this is within the folder). Once the module is open, on the input volume drop down menu select your 4D image, in the other one just create a new volume, this was a dummy and actually doesn’t do anything. Once you click apply, the program will create a new volume of just the 1st echo, or whatever you change line 123 to. 

 

Alternatively, and probably easier, I’ve attached some of the code from that module and altered slightly (create3DFrom4D.py). Open the python module in slicer and input the below code when the 4D image of interest is open in slicer. Before doing so, replace the star on line 2 with your filename, and you can replace the number (1) on line 3 with what slice of the 4th dimension you want to extract. This will create a new volume that is named based on the filename of the original and the slice of the 4th dimension used. 

 

If anyone sees any issues with this please feel free to chime in. 

 

Hope that helps, 

 

Anthony. 

 

 

 

 

 

 

On Aug 10, 2016, at 6:25 PM, Beers, Andrew Lawrence <[hidden email]> wrote:

 

Hello all!

 

I’ve recently been loading some 4D volumes from DICOM into Multivolume NRRD files. This has worked well with the multivolume explorer, but I would like to split these multivolumes into different individual 3D volumes at each time point for some other processing. Does anyone know of any tool or scripting functionality within Slicer that I could use to split up these 4D multivolumes into a group of individual files?

 

Thanks for your help,

Andrew

(MGH)

_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to 
[hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

 


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ

_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ