How can I open compressed DICOM slices in a sorted way?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I open compressed DICOM slices in a sorted way?

Clare
I have several stacks of compressed slices (DICOM images). ImageJ opens them in a disorderly way. Is there some way to sort this images?. I think there is the possibility to sort them if they are uncompressed, but I need to do that only for compressed images.
Reply | Threaded
Open this post in threaded view
|

Re: How can I open compressed DICOM slices in a sorted way?

Martin Höhne
Hello Clare,

I don´t have much expericence with DICOM stacks, but the one I worked with was also sorted in a weird way. The stack I had could be sorted as follows.

1) Open the DICOM series with  File > Import > Image sequence ...
2) Then run the macro pasted below
3) Image>Stacks>Tools>Stack sorter>Sort by label

Hope that works for your stack as well
Martin



for (j=1; j<=nSlices; j++) {
        setSlice(j);
        imageNumber = getInfo("0020,0013");
        imageNumber=IJ.pad(imageNumber,3); //three digit number. Otherwise sorting will be 1,10,2 ...
        seriesNumber = getInfo("0020,0011");
        seriesNumber=IJ.pad(seriesNumber,3);
        setMetadata("Label", seriesNumber+"_"+imageNumber);
        run("Properties...", "voxel_depth=sliceSpacing");
}
// the stack needs to be sorted by clicking on "sort by label"
// Image>Stacks>Tools>Stack sorter>Sort by label
run("Stack Sorter");