[ITK-users] Resampling and manual image
Guillaume Lemaître
g.lemaitre58 at gmail.com
Tue Apr 22 14:43:37 EDT 2014
Hi all,
I would like to have some advise to do the following task.
I have a set of annotated DICOM (binary 0 - 255 intensity) with a given
spacing, orientation and position. This manual segmentation is
corresponding to a prostate from an initial T2W sequence.
A part of DICOM, I have an MRSI sequence from Siemens (*.rda) in which the
header is containing information such as position, orientation and spacing
of the csi grid matrix used during the acquisition.
My aim would be to resample the annotated DICOM serie into a new DICOM
serie using the MRSI header. I attached the code that I tried to implement
to do this task but I don't succeed to obtain a correct serie when saving
into a DICOM serie. When opening the stored DICOM serie, it seems that the
field regarding the z spacing and the position of the first voxel are not
equal to the one of the rda manually affected during the resampling.
I was wondering to know the best way to do such manipulation. For instance,
it could be better to create a manual image using the field of the rda file
and just use the intensities
ResampleFilterType::Pointer resampler = ResampleFilterType::New();
resampler->SetInput(inputAnnotatedVolume->GetOutput());
resampler->SetTransform(transform);
resampler->SetInterpolator(interpolator);
// Create a type compatible to ITK
// Define the new origin
double* outputOrigin = new double [rdaPatient.getPositionPatient().size()];
for(int i = 0; i < rdaPatient.getPositionPatient().size(); i++)
outputOrigin[i] = rdaPatient.getPositionPatient()[i];
resampler->SetOutputOrigin(outputOrigin);
// Define the new spacing
double* outputSpacing = new double [rdaPatient.getPixelSpacing().size()];
for(int i = 0; i < rdaPatient.getPixelSpacing().size(); i++)
outputSpacing[i] = rdaPatient.getPixelSpacing()[i];
resampler->SetOutputSpacing(outputSpacing);
// Define the new orientation
typename ResampleFilterType::DirectionType outputDirection;
//double ** outputDirection = new double* [3];
//for(int i = 0; i < 3 ; i++)
// outputDirection[i] = new double [3];
// Affect the new values
outputDirection[0][0] = rdaPatient.getOrientationPatient()[0][0];
outputDirection[0][1] = rdaPatient.getOrientationPatient()[0][1];
outputDirection[0][2] = rdaPatient.getVoiNormalVector()[0];
outputDirection[1][0] = rdaPatient.getOrientationPatient()[1][0];
outputDirection[1][1] = rdaPatient.getOrientationPatient()[1][1];
outputDirection[1][2] = rdaPatient.getVoiNormalVector()[1];
outputDirection[2][0] = rdaPatient.getOrientationPatient()[2][0];
outputDirection[2][1] = rdaPatient.getOrientationPatient()[2][1];
outputDirection[2][2] = rdaPatient.getVoiNormalVector()[2];
resampler->SetOutputDirection(inputAnnotatedVolume->GetOutput()->GetDirection());
// Define the size of the ouput
// Let's comput the new size
InputImageType::SizeType outputSize;
typedef InputImageType::SizeType::SizeValueType SizeValueType;
outputSize[0] =
static_cast<SizeValueType>(rdaPatient.getCsiMatrixSize()[0]);
outputSize[1] =
static_cast<SizeValueType>(rdaPatient.getCsiMatrixSize()[1]);
outputSize[2] =
static_cast<SizeValueType>(rdaPatient.getCsiMatrixSize()[2]);
resampler->SetSize(outputSize);
// Resampling now
resampler->Update();
Thanks in advance for the advices,
--
*LEMAÎTRE GuillaumePhD CandiateMSc Erasmus Mundus ViBOT (Vision-roBOTic)MSc
Business Innovation and Technology Management (in progress)*
g.lemaitre58 at gmail.com
*ViCOROB - Computer Vision and Robotic Team*
Universitat de Girona, Campus Montilivi, Edifici P-IV 17071 Girona
Tel. +34 972 41 98 12 - Fax. +34 972 41 82 59
http://vicorob.udg.es/
*LE2I - Le Creusot*IUT Le Creusot, Laboratoire LE2I, 12 rue de la Fonderie,
71200 Le Creusot
Tel. +33 3 85 73 10 90 - Fax. +33 3 85 73 10 97
http://le2i.cnrs.fr
https://sites.google.com/site/glemaitre58/
Vice - Chairman of A.S.C. Fours UFOLEP
Chairman of A.S.C. Fours FFC
Webmaster of http://ascfours.free.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140422/32109145/attachment.html>
More information about the Insight-users
mailing list