[vtkusers] how to change image order

Lic. José M. Rodriguez Bacallao jmrbcu at gmail.com
Mon Dec 21 15:13:18 EST 2009


well, I use "U" as a short way to write "you".

in fact I use vtkStringArray to set the slices file names but if after
the call to Update() in the reader I need to change the sort order,
when I apply the new order to the vtkStringArray, set the new ordered
list of slices file names to the reader with SetFileNames, call
Update() in the reader, then the reader will try to load those slices
files again? this is my doubt!!!

On 12/21/09, David Gobbi <david.gobbi at gmail.com> wrote:
> On Mon, Dec 21, 2009 at 12:05 PM, Lic. José M. Rodriguez Bacallao
> <jmrbcu at gmail.com> wrote:
>>> There is no filter to reorganize the vtkImageData
>>> slices with strides and such.  I had to read in the data
>>> slice-by-slice (i.e. a different reader for each slice) and use
>>> vtkImageAppend to put it together in the right order.
>>
>> how do U do that? could U send me an example code?
>
> The English second-person pronoun is "you."  I've never met this "U" person.
>
> Actually, I just remembered that doing ImageAppend isn't necessary in
> VTK anymore.  It's possible for vtkImageReader2 to sort the slices in
> whatever order you want, so as long as vtkGDCMReader inherits from
> vtkImageReader2, then it should be able to do this too.  Here is what
> to do:
>
> In VTK, there is a class called vtkStringArray, that is a list of
> strings.  You can use it to store all of the slice filenames of the
> DICOM series that you want to read, just make sure that all the
> filenames in the vtkStringArray are in the right order.
>
> vtkStringArray *sliceList = vtkStringArray::New();
> sliceList->InsertNextValue("slice1.dcm");;
> sliceList->InsertNextValue("slice2.dcm");
> etc.
>
> Then you do the following:
>
> reader->SetFileNames(sliceList);
>
> Mathieu might know whether this will work with the GDCM reader.  There
> are also classes to help create a vtkStringArray from a directory of
> files: vtkGlobFileNames and vtkSortFileNames.
>
>    David
>


-- 
Lic. José M. Rodriguez Bacallao
Centro de Biofisica Medica
-----------------------------------------------------------------
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-----------------------------------------------------------------



More information about the vtkusers mailing list