[ITK] [ITK-users] itk - Writing dicom files from single 3D file
AI
audrey.istace at imavie.fr
Tue Mar 24 11:57:35 EDT 2015
Hi Matias,
Thank you for your answer.
If your code is working with DCMTKImageIO and not GDCMImageIO, I would be happy to see it.
For me it works using gdcm but not using dcmtk (compilation is ok, but no dicom is written in my output directory after execution), and I would like to use dcmtk.
De : Matias Montroull [via ITK Insight Users] [mailto:ml-node+s2283740n7587037h21 at n2.nabble.com]
Envoyé : mardi 24 mars 2015 16:11
À : Audrey Istace
Objet : Re: [ITK-users] itk - Writing dicom files from single 3D file
I'm able to write individual slices from a mha or mhd file, is that the same as nifti file? if so, I can send you the code, I think it's a copy/paste from one of the examples out there.
On Mon, Mar 23, 2015 at 12:11 PM, AI <[hidden email]</user/SendEmail.jtp?type=node&node=7587037&i=0>> wrote:
Hello,
I would like to write Dicom files from a nifti image files using
DCMTKImageIO. In the code below, I read a nifti file using
itkImageFileReader, and then try to write dicom files using
itkImageSeriesWriter. I was not able to do it, probably because of the
SetMetaDataDictionaryArray method, that I don’t know how to use since I
don’t read dicom series as input. Can you help me with that ?
Thank you very much,
Audrey
#include "itkDCMTKImageIO.h"
#include "itkNumericSeriesFileNames.h"
#include "itkImageFileReader.h"
#include "itkImageSeriesWriter.h"
int main(int argc, char *argv[])
{
typedef signed short
PixelType;
const unsigned int
Dimension = 3;
typedef itk::Image< PixelType, Dimension >
ImageType;
typedef itk::Image< PixelType, 2 >
OutputImageType;
typedef itk::ImageFileReader< ImageType >
ReaderType;
typedef itk::DCMTKImageIO
ImageIOType;
typedef itk::NumericSeriesFileNames
NamesGeneratorType;
typedef itk::ImageSeriesWriter< ImageType, OutputImageType >
WriterType;
ImageIOType::Pointer dcmtkIO = ImageIOType::New();
NamesGeneratorType::Pointer namesGenerator =
NamesGeneratorType::New();
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( "../../out.nii" );
reader->Update();
itksys::SystemTools::MakeDirectory( "../../OutputDicom/" );
std::string seriesFormat = "../../OutputDicom/IM%d.dcm";
namesGenerator->SetSeriesFormat (seriesFormat.c_str());
namesGenerator->SetStartIndex (1);
namesGenerator->SetEndIndex (166);
writer->SetInput( reader->GetOutput() );
writer->SetImageIO( dcmtkIO );
writer->SetFileNames( namesGenerator->GetFileNames() );
// writer->SetMetaDataDictionaryArray(
reader->GetMetaDataDictionaryArray() );
writer->Update();
}
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/itk-Writing-dicom-files-from-single-3D-file-tp7587034.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
_____________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
________________________________
If you reply to this email, your message will be added to the discussion below:
http://itk-insight-users.2283740.n2.nabble.com/itk-Writing-dicom-files-from-single-3D-file-tp7587034p7587037.html
To unsubscribe from itk - Writing dicom files from single 3D file, click here<http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7587034&code=YXVkcmV5LmlzdGFjZUBpbWF2aWUuZnJ8NzU4NzAzNHw4NzExNjY2MzA=>.
NAML<http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/itk-Writing-dicom-files-from-single-3D-file-tp7587034p7587040.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list