From matimontg at gmail.com Sat Apr 1 02:48:08 2017 From: matimontg at gmail.com (Matias) Date: Fri, 31 Mar 2017 23:48:08 -0700 (MST) Subject: [ITK] [ITK-users] SimpleITK Serieswriter and DicomTags In-Reply-To: <54518069-C5F9-445E-983C-FDD5A2EDA798@mail.nih.gov> References: <1490878156334-38050.post@n7.nabble.com> <031C16D1-4B43-4BD8-9C80-91A2F9C72B6B@mail.nih.gov> <54518069-C5F9-445E-983C-FDD5A2EDA798@mail.nih.gov> Message-ID: Thanks Yaniv. So how do I get this branch? I simply download the latest version of SimpleITK? El vie., 31 de mar. de 2017 a la(s) 19:18, Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] [via ITK - Users] escribi?: > Hello Matias, > > > > Please take a look at the following github pull request ( > https://github.com/SimpleITK/SimpleITK/pull/134), this branch should > provide the functionality you are looking for. See the Python example > script included in the commit for the usage of the DICOM series writing. > > > > hope this helps > > Ziv > > > > > > *From: *Matias <[hidden email] > > > > > *Date: *Thursday, March 30, 2017 at 12:14 PM > > *To: *"[hidden email] > " <[hidden email] > > > > > *Subject: *Re: [ITK-users] [ITK] SimpleITK Serieswriter and DicomTags > > > > Yes, this is what I would need to migrate to C#: > > It basically reads a dicom directory and performs rotation on the volume, > then writes the resulting images back to a directory, copying the tags from > the original images. > > > > #include "itkImage.h" > > #include "itkGDCMImageIO.h" > > #include "itkGDCMSeriesFileNames.h" > > #include "itkImageSeriesReader.h" > > #include "itkResampleImageFilter.h" > > #include "itkEuler3DTransform.hxx" > > #include "gdcmUIDGenerator.h" > > > > #include "itkImageFileWriter.h" > > #include "itkImageSeriesWriter.h" > > #include "itkNumericSeriesFileNames.h" > > #include "itkTranslationTransform.h" > > #include "string.h"; > > #include > > > > #include > > #include > > #include > > > > > > > > static void CopyDictionary(itk::MetaDataDictionary &fromDict, > > itk::MetaDataDictionary &toDict); > > > > int main(int argc, char* argv[]) > > { > > if (argc < 8) > > { > > std::cerr << "Uso: " << std::endl; > > std::cerr << argv[0] << " Directorio_A_Rotar DirectorioResultante Gamma > Beta Alfa CentroRotacionX CentroRotacionY CentroRotacionZ" > > << std::endl; > > return EXIT_FAILURE; > > } > > > > typedef signed short PixelType; > > const unsigned int Dimension = 3; > > const unsigned int Dimension_Serie = 2; > > typedef itk::Image< PixelType, Dimension > ImageType; > > typedef itk::Image ImageType_Serie; > > > > typedef itk::ImageSeriesReader< ImageType > ReaderType; > > ReaderType::Pointer reader = ReaderType::New(); > > > > typedef itk::GDCMImageIO ImageIOType; > > ImageIOType::Pointer gdcmIO = ImageIOType::New(); > > reader->SetImageIO(gdcmIO); > > > > typedef itk::GDCMSeriesFileNames NamesGeneratorType; > > NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New(); > > nameGenerator->SetUseSeriesDetails(true); > > nameGenerator->AddSeriesRestriction("0008|0021"); > > nameGenerator->SetDirectory(argv[1]); > > > > try > > { > > std::cout << std::endl << "The directory: " << std::endl; > > std::cout << std::endl << argv[1] << std::endl << std::endl; > > std::cout << "Contains the following DICOM Series: "; > > std::cout << std::endl << std::endl; > > > > typedef std::vector< std::string > SeriesIdContainer; > > const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs(); > > SeriesIdContainer::const_iterator seriesItr = seriesUID.begin(); > > SeriesIdContainer::const_iterator seriesEnd = seriesUID.end(); > > while (seriesItr != seriesEnd) > > { > > std::cout << seriesItr->c_str() << std::endl; > > ++seriesItr; > > } > > > > std::string seriesIdentifier; > > > > seriesIdentifier = seriesUID.begin()->c_str(); > > > > > > std::cout << std::endl << std::endl; > > std::cout << "Now reading series: " << std::endl << std::endl; > > std::cout << seriesIdentifier << std::endl; > > std::cout << std::endl << std::endl; > > > > typedef std::vector< std::string > FileNamesContainer; > > FileNamesContainer fileNames; > > fileNames = nameGenerator->GetFileNames(seriesIdentifier); > > > > reader->SetFileNames(fileNames); > > > > try > > { > > reader->Update(); > > } > > catch (itk::ExceptionObject &ex) > > { > > std::cout << ex << std::endl; > > return EXIT_FAILURE; > > } > > > > const ImageType * inputImage = reader->GetOutput(); > > /*int numerodedicoms = inputImage->GetLargestPossibleRegion().GetSize()[2]; > > int dicomcentral = numerodedicoms / 2; > > std::cout << "Dimenion " << dicomcentral << std::endl;*/ > > //itk::EncapsulateMetaData(dictionary, > "0020|0032","-208\\-236\\66"); > > > > typedef itk::ResampleImageFilter FilterType; > > FilterType::Pointer FiltroResample = FilterType::New(); > > FiltroResample->SetInput(reader->GetOutput()); > > > > typedef itk::LinearInterpolateImageFunction > InterpolatorType; > > InterpolatorType::Pointer interpolator = InterpolatorType::New(); > > FiltroResample->SetInterpolator(interpolator); > > FiltroResample->SetOutputDirection(inputImage->GetDirection()); > > FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); > > > > ImageType::SizeType inputSize = > inputImage->GetLargestPossibleRegion().GetSize(); > > FiltroResample->SetSize(inputSize); > > > > const ImageType::SpacingType& inputSpacing = inputImage->GetSpacing(); > > FiltroResample->SetOutputSpacing(inputSpacing); > > > > FiltroResample->SetDefaultPixelValue(-1000); //Cambiar por un parametro > > > > typedef itk::Euler3DTransform< double > TransformType; //Transform > > TransformType::Pointer transform = TransformType::New(); > > double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, > centro_rotacion_Z; > > gamma = atof(argv[3]); > > beta= atof(argv[4]); > > alfa = atof(argv[5]); > > centro_rotacion_X = atof(argv[6]); > > centro_rotacion_Y = atof(argv[7]); > > centro_rotacion_Z = atof(argv[8]); > > transform->SetRotation(gamma, beta, alfa); //Radianes en el siguiente > orden en ITK: Gamma, Beta, Alfa | Ibarra > > //double centro[3] = { -14.8371, -54.9443, 175.75 }; //XmmPromedio, > YmmPromedio, Z Central (mm): Leer directorio y tomar la del medio > > double centro[3] = { centro_rotacion_X, centro_rotacion_Y, > centro_rotacion_Z }; //XmmPromedio, YmmPromedio, Z Central (mm): Leer > directorio y tomar la del medio > > transform->SetCenter(centro); > > std::cout << "Centro: " << std::endl << std::endl; > > std::cout << transform->GetCenter() << std::endl; > > > > FiltroResample->SetTransform(transform); > > //FiltroResample->SetMetaDataDictionary(dictionary); > > try > > { > > FiltroResample->Update(); > > } > > catch (itk::ExceptionObject &ex) > > { > > return EXIT_FAILURE; > > } > > > > > > > > ReaderType::DictionaryRawPointer inputDict = > (*(reader->GetMetaDataDictionaryArray()))[0]; > > ReaderType::DictionaryArrayType outputArray; > > //std::cout << "array: " << std::endl << outputArray[0] << std::endl; > > // To keep the new series in the same study as the original we need > > // to keep the same study UID. But we need new series and frame of > > // reference UID's. > > gdcm::UIDGenerator suid; > > //std::string seriesUID = suid.Generate(); > > gdcm::UIDGenerator fuid; > > std::string frameOfReferenceUID = fuid.Generate(); > > > > std::string studyUID; > > std::string sopClassUID; > > itk::ExposeMetaData(*inputDict, "0020|000d", studyUID); > > itk::ExposeMetaData(*inputDict, "0008|0016", sopClassUID); > > gdcmIO->KeepOriginalUIDOn(); > > > > using namespace std; > > double myArray_Z[70]; //Cambiar esto por un argumento que especifica la > cantidad de imagenes. > > double myArray_X[70]; //Cambiar esto por un argumento que especifica la > cantidad de imagenes. > > double myArray_Y[70]; //Cambiar esto por un argumento que especifica la > cantidad de imagenes. > > > > ifstream file("file.txt"); > > if (file.is_open()) > > { > > for (int i = 0; i < 70; ++i) //Recordar cambiar por el argumento que > especifica cantidad de imagenes > > { > > file >> myArray_Z[i]; > > } > > } > > std::cout << "valor primer Z array: " << std::endl << std::endl; > > std::cout << myArray_Z[0] << std::endl; > > > > for (unsigned int f = 0; f < inputSize[2]; f++) > > { > > // Create a new dictionary for this slice > > ReaderType::DictionaryRawPointer dict = new ReaderType::DictionaryType; > > > > // Copy the dictionary from the first slice > > CopyDictionary(*inputDict, *dict); > > > > // Set the UID's for the study, series, SOP and frame of reference > > itk::EncapsulateMetaData(*dict, "0020|000d", studyUID); > > //itk::EncapsulateMetaData(*dict, "0020|000e", seriesUID); > > itk::EncapsulateMetaData(*dict, "0020|0052", > frameOfReferenceUID); > > > > gdcm::UIDGenerator sopuid; > > std::string sopInstanceUID = sopuid.Generate(); > > > > itk::EncapsulateMetaData(*dict, "0008|0018", sopInstanceUID); > > itk::EncapsulateMetaData(*dict, "0002|0003", sopInstanceUID); > > > > // Change fields that are slice specific > > std::ostringstream value; > > value.str(""); > > value << f + 1; > > > > // Image Number > > itk::EncapsulateMetaData(*dict, "0020|0013", value.str()); > > > > // Series Description - Append new description to current series > > // description > > std::string oldSeriesDesc; > > itk::ExposeMetaData(*inputDict, "0008|103e", oldSeriesDesc); > > > > value.str(""); > > value << oldSeriesDesc > > << ": Resampled with pixel spacing " > > << inputSpacing[0] << ", " > > << inputSpacing[1] << ", " > > << inputSpacing[2]; > > // This is an long string and there is a 64 character limit in the > > // standard > > unsigned lengthDesc = value.str().length(); > > > > std::string seriesDesc(value.str(), 0, > > lengthDesc > 64 ? 64 > > : lengthDesc); > > itk::EncapsulateMetaData(*dict, "0008|103e", seriesDesc); > > > > // Series Number > > value.str(""); > > value << 1001; > > itk::EncapsulateMetaData(*dict, "0020|0011", value.str()); > > > > // Derivation Description - How this image was derived > > value.str(""); > > for (int i = 0; i < argc; i++) > > { > > value << argv[i] << " "; > > } > > > > lengthDesc = value.str().length(); > > std::string derivationDesc(value.str(), 0, > > lengthDesc > 1024 ? 1024 > > : lengthDesc); > > itk::EncapsulateMetaData(*dict, "0008|2111", derivationDesc); > > > > // Image Position Patient: This is calculated by computing the > > // physical coordinate of the first pixel in each slice. > > ImageType::PointType position; > > ImageType::IndexType index; > > index[0] = 0; > > index[1] = 0; > > index[2] = myArray_Z[f]; > > FiltroResample->GetOutput()->TransformIndexToPhysicalPoint(index, > position); > > > > //El origen que calculamos en el proyecto no se toca. (Origen = origen - > average) > > > > //Cambiamos el ImageOrientationPatient SOLAMENTE si el valor original en > la imagen es: 1\0\0\0\1\0. En el caso que se cambia el signo, se debe > cambiar el signo del origen > > //value.str(""); > > //value << -1 << "\\" << 0 << "\\" << 0 << "\\" << 0 << "\\" << -1 << "\\" > << 0; //PASAR ESTO POR ARGUMENTO!!! > > //itk::EncapsulateMetaData(*dict, "0020|0037", value.str()); > > > > value.str(""); > > value << -235.1629 << "\\" << -195.0557 << "\\" << myArray_Z[f]; //PASAR > ESTO POR ARGUMENTO!!! El origen - Centro > > itk::EncapsulateMetaData(*dict, "0020|0032", value.str()); > > > > > > // Slice Location: For now, we store the z component of the Image > > // Position Patient. > > value.str(""); > > value << position[2]; > > itk::EncapsulateMetaData(*dict, "0020|1041", value.str()); > > > > // Slice Thickness: For now, we store the z spacing > > value.str(""); > > value << inputSpacing[2]; > > itk::EncapsulateMetaData(*dict, "0018|0050", > > value.str()); > > // Spacing Between Slices > > itk::EncapsulateMetaData(*dict, "0018|0088", > > value.str()); > > > > // Save the dictionary > > outputArray.push_back(dict); > > } > > > > > > typedef itk::ImageFileWriter< ImageType > WriterType; > > WriterType::Pointer writer = WriterType::New(); > > > > typedef itk::ImageSeriesWriter< ImageType, ImageType_Serie > > SeriesWriterType; > > SeriesWriterType::Pointer seriesWriter = SeriesWriterType::New(); > > seriesWriter->SetInput(FiltroResample->GetOutput()); > > > > writer->SetFileName(argv[2]); > > writer->SetInput(FiltroResample->GetOutput()); > > > > itksys::SystemTools::MakeDirectory("Test"); //PASAR ESTO POR ARGUMENTO!! > > typedef itk::NumericSeriesFileNames OutputNamesGeneratorType; > > OutputNamesGeneratorType::Pointer outputNames = > OutputNamesGeneratorType::New(); > > std::string seriesFormat("Test"); //PASAR ESTO POR ARGUMENTO!! > > seriesFormat = seriesFormat + "/" + "IM%d.dcm"; > > outputNames->SetSeriesFormat(seriesFormat.c_str()); > > outputNames->SetStartIndex(1); > > outputNames->SetEndIndex(inputSize[2]); > > > > seriesWriter->SetImageIO(gdcmIO); > > seriesWriter->SetFileNames(outputNames->GetFileNames()); > > seriesWriter->SetMetaDataDictionaryArray(&outputArray); > > > > std::cout << "Escribiendo la imagen como..." << std::endl << std::endl; > > std::cout << argv[2] << std::endl << std::endl; > > > > try > > { > > writer->Update(); > > seriesWriter->Update(); > > } > > catch (itk::ExceptionObject &ex) > > { > > std::cout << ex << std::endl; > > return EXIT_FAILURE; > > } > > > > > > } > > catch (itk::ExceptionObject &ex) > > { > > std::cout << ex << std::endl; > > return EXIT_FAILURE; > > } > > > > return EXIT_SUCCESS; > > > > } > > > > void CopyDictionary(itk::MetaDataDictionary &fromDict, > itk::MetaDataDictionary &toDict) > > { > > typedef itk::MetaDataDictionary DictionaryType; > > > > DictionaryType::ConstIterator itr = fromDict.Begin(); > > DictionaryType::ConstIterator end = fromDict.End(); > > typedef itk::MetaDataObject< std::string > MetaDataStringType; > > > > while (itr != end) > > { > > itk::MetaDataObjectBase::Pointer entry = itr->second; > > > > MetaDataStringType::Pointer entryvalue = > > dynamic_cast(entry.GetPointer()); > > if (entryvalue) > > { > > std::string tagkey = itr->first; > > std::string tagvalue = entryvalue->GetMetaDataObjectValue(); > > itk::EncapsulateMetaData(toDict, tagkey, tagvalue); > > } > > ++itr; > > } > > } > > > > > > El jue., 30 de mar. de 2017 a la(s) 11:25, Lowekamp, Bradley (NIH/NLM/LHC) > [C] [via ITK - Users] <[hidden email]> escribi?: > > Hello, > > Writing correct DICOM continues to be a struggle with SimpleITK and ITK. > It is generally recommended to directly use GDCM or DCMTK to write a proper > DICOM series. > > SimpleITK tries to keep things, well, simple and straight forward. But ITK > ties to do some smart things, which get in the way for certain uses with > SimpleITK. We are trying to document and develop a nominal set of DICOM > output operations that work in SimpleITK. > > Do you have working C++ code that works for your intended operation? Can > you share a small section of code which does what you expect it C++? > > Thank, > Brad > > > > > On Mar 30, 2017, at 8:49 AM, Matias <[hidden email] > > wrote: > > > > Hi, > > > > I've been dealing with ITK for years in C++ and now I would need to use > > SimpleITK and C# as far as I can in a new proyect. > > > > Is the SimpleITK SeriesWriter working for Dicom Files? Last time I tried > to > > use it I had problems with the DicomTags, these would not copy or there > was > > no method to copy the tags to the resulting slices. > > > > Currently, I read a volume of slices, apply rotation and then I need to > > write the resulting image as another set of slices AND keeping tag > > information such as patient name, etc. > > > > Thank you, > > > > Matias. > > > > > > > > -- > > View this message in context: > http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050.html > > Sent from the ITK - 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 > > _______________________________________________ > > Community mailing list > > > [hidden email] > > http://public.kitware.com/mailman/listinfo/community > > > _____________________________________ > 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 > > ------------------------------ > > *If you reply to this email, your message will be added to the discussion > below:* > > > http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050p38052.html > > To unsubscribe from SimpleITK Serieswriter and DicomTags, click here. > NAML > > > -- > > Matias > > > ------------------------------ > > View this message in context: Re: [ITK-users] [ITK] SimpleITK > Serieswriter and DicomTags > > > > Sent from the ITK - 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 > > > If you reply to this email, your message will be added to the discussion > below: > > http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050p38063.html > To unsubscribe from SimpleITK Serieswriter and DicomTags, click here > > . > NAML > > -- Matias -- View this message in context: http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050p38064.html Sent from the ITK - Users mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Sat Apr 1 09:37:05 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Sat, 1 Apr 2017 09:37:05 -0400 Subject: [ITK] [ITK-users] SimpleITK Serieswriter and DicomTags In-Reply-To: References: <1490878156334-38050.post@n7.nabble.com> <031C16D1-4B43-4BD8-9C80-91A2F9C72B6B@mail.nih.gov> <54518069-C5F9-445E-983C-FDD5A2EDA798@mail.nih.gov> Message-ID: Hi Matias, you should use branch dicomWrite from Ziv's fork . Regards, D?enan On Sat, Apr 1, 2017 at 2:48 AM, Matias wrote: > Thanks Yaniv. So how do I get this branch? I simply download the latest > version of SimpleITK? > > El vie., 31 de mar. de 2017 a la(s) 19:18, Yaniv, Ziv Rafael (NIH/NLM/LHC) > [C] [via ITK - Users] <[hidden email] > > escribi?: > >> Hello Matias, >> >> >> >> Please take a look at the following github pull request ( >> https://github.com/SimpleITK/SimpleITK/pull/134), this branch should >> provide the functionality you are looking for. See the Python example >> script included in the commit for the usage of the DICOM series writing. >> >> >> >> hope this helps >> >> Ziv >> >> >> >> >> >> *From: *Matias <[hidden email] >> > >> >> >> *Date: *Thursday, March 30, 2017 at 12:14 PM >> >> *To: *"[hidden email] >> " <[hidden email] >> > >> >> >> *Subject: *Re: [ITK-users] [ITK] SimpleITK Serieswriter and DicomTags >> >> >> >> Yes, this is what I would need to migrate to C#: >> >> It basically reads a dicom directory and performs rotation on the volume, >> then writes the resulting images back to a directory, copying the tags from >> the original images. >> >> >> >> #include "itkImage.h" >> >> #include "itkGDCMImageIO.h" >> >> #include "itkGDCMSeriesFileNames.h" >> >> #include "itkImageSeriesReader.h" >> >> #include "itkResampleImageFilter.h" >> >> #include "itkEuler3DTransform.hxx" >> >> #include "gdcmUIDGenerator.h" >> >> >> >> #include "itkImageFileWriter.h" >> >> #include "itkImageSeriesWriter.h" >> >> #include "itkNumericSeriesFileNames.h" >> >> #include "itkTranslationTransform.h" >> >> #include "string.h"; >> >> #include >> >> >> >> #include >> >> #include >> >> #include >> >> >> >> >> >> >> >> static void CopyDictionary(itk::MetaDataDictionary &fromDict, >> >> itk::MetaDataDictionary &toDict); >> >> >> >> int main(int argc, char* argv[]) >> >> { >> >> if (argc < 8) >> >> { >> >> std::cerr << "Uso: " << std::endl; >> >> std::cerr << argv[0] << " Directorio_A_Rotar DirectorioResultante Gamma >> Beta Alfa CentroRotacionX CentroRotacionY CentroRotacionZ" >> >> << std::endl; >> >> return EXIT_FAILURE; >> >> } >> >> >> >> typedef signed short PixelType; >> >> const unsigned int Dimension = 3; >> >> const unsigned int Dimension_Serie = 2; >> >> typedef itk::Image< PixelType, Dimension > ImageType; >> >> typedef itk::Image ImageType_Serie; >> >> >> >> typedef itk::ImageSeriesReader< ImageType > ReaderType; >> >> ReaderType::Pointer reader = ReaderType::New(); >> >> >> >> typedef itk::GDCMImageIO ImageIOType; >> >> ImageIOType::Pointer gdcmIO = ImageIOType::New(); >> >> reader->SetImageIO(gdcmIO); >> >> >> >> typedef itk::GDCMSeriesFileNames NamesGeneratorType; >> >> NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New(); >> >> nameGenerator->SetUseSeriesDetails(true); >> >> nameGenerator->AddSeriesRestriction("0008|0021"); >> >> nameGenerator->SetDirectory(argv[1]); >> >> >> >> try >> >> { >> >> std::cout << std::endl << "The directory: " << std::endl; >> >> std::cout << std::endl << argv[1] << std::endl << std::endl; >> >> std::cout << "Contains the following DICOM Series: "; >> >> std::cout << std::endl << std::endl; >> >> >> >> typedef std::vector< std::string > SeriesIdContainer; >> >> const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs(); >> >> SeriesIdContainer::const_iterator seriesItr = seriesUID.begin(); >> >> SeriesIdContainer::const_iterator seriesEnd = seriesUID.end(); >> >> while (seriesItr != seriesEnd) >> >> { >> >> std::cout << seriesItr->c_str() << std::endl; >> >> ++seriesItr; >> >> } >> >> >> >> std::string seriesIdentifier; >> >> >> >> seriesIdentifier = seriesUID.begin()->c_str(); >> >> >> >> >> >> std::cout << std::endl << std::endl; >> >> std::cout << "Now reading series: " << std::endl << std::endl; >> >> std::cout << seriesIdentifier << std::endl; >> >> std::cout << std::endl << std::endl; >> >> >> >> typedef std::vector< std::string > FileNamesContainer; >> >> FileNamesContainer fileNames; >> >> fileNames = nameGenerator->GetFileNames(seriesIdentifier); >> >> >> >> reader->SetFileNames(fileNames); >> >> >> >> try >> >> { >> >> reader->Update(); >> >> } >> >> catch (itk::ExceptionObject &ex) >> >> { >> >> std::cout << ex << std::endl; >> >> return EXIT_FAILURE; >> >> } >> >> >> >> const ImageType * inputImage = reader->GetOutput(); >> >> /*int numerodedicoms = inputImage->GetLargestPossibleRegion(). >> GetSize()[2]; >> >> int dicomcentral = numerodedicoms / 2; >> >> std::cout << "Dimenion " << dicomcentral << std::endl;*/ >> >> //itk::EncapsulateMetaData(dictionary, >> "0020|0032","-208\\-236\\66"); >> >> >> >> typedef itk::ResampleImageFilter FilterType; >> >> FilterType::Pointer FiltroResample = FilterType::New(); >> >> FiltroResample->SetInput(reader->GetOutput()); >> >> >> >> typedef itk::LinearInterpolateImageFunction >> InterpolatorType; >> >> InterpolatorType::Pointer interpolator = InterpolatorType::New(); >> >> FiltroResample->SetInterpolator(interpolator); >> >> FiltroResample->SetOutputDirection(inputImage->GetDirection()); >> >> FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); >> >> >> >> ImageType::SizeType inputSize = inputImage->GetLargestPossibleRegion(). >> GetSize(); >> >> FiltroResample->SetSize(inputSize); >> >> >> >> const ImageType::SpacingType& inputSpacing = inputImage->GetSpacing(); >> >> FiltroResample->SetOutputSpacing(inputSpacing); >> >> >> >> FiltroResample->SetDefaultPixelValue(-1000); //Cambiar por un parametro >> >> >> >> typedef itk::Euler3DTransform< double > TransformType; //Transform >> >> TransformType::Pointer transform = TransformType::New(); >> >> double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, >> centro_rotacion_Z; >> >> gamma = atof(argv[3]); >> >> beta= atof(argv[4]); >> >> alfa = atof(argv[5]); >> >> centro_rotacion_X = atof(argv[6]); >> >> centro_rotacion_Y = atof(argv[7]); >> >> centro_rotacion_Z = atof(argv[8]); >> >> transform->SetRotation(gamma, beta, alfa); //Radianes en el siguiente >> orden en ITK: Gamma, Beta, Alfa | Ibarra >> >> //double centro[3] = { -14.8371, -54.9443, 175.75 }; //XmmPromedio, >> YmmPromedio, Z Central (mm): Leer directorio y tomar la del medio >> >> double centro[3] = { centro_rotacion_X, centro_rotacion_Y, >> centro_rotacion_Z }; //XmmPromedio, YmmPromedio, Z Central (mm): Leer >> directorio y tomar la del medio >> >> transform->SetCenter(centro); >> >> std::cout << "Centro: " << std::endl << std::endl; >> >> std::cout << transform->GetCenter() << std::endl; >> >> >> >> FiltroResample->SetTransform(transform); >> >> //FiltroResample->SetMetaDataDictionary(dictionary); >> >> try >> >> { >> >> FiltroResample->Update(); >> >> } >> >> catch (itk::ExceptionObject &ex) >> >> { >> >> return EXIT_FAILURE; >> >> } >> >> >> >> >> >> >> >> ReaderType::DictionaryRawPointer inputDict = (*(reader-> >> GetMetaDataDictionaryArray()))[0]; >> >> ReaderType::DictionaryArrayType outputArray; >> >> //std::cout << "array: " << std::endl << outputArray[0] << std::endl; >> >> // To keep the new series in the same study as the original we need >> >> // to keep the same study UID. But we need new series and frame of >> >> // reference UID's. >> >> gdcm::UIDGenerator suid; >> >> //std::string seriesUID = suid.Generate(); >> >> gdcm::UIDGenerator fuid; >> >> std::string frameOfReferenceUID = fuid.Generate(); >> >> >> >> std::string studyUID; >> >> std::string sopClassUID; >> >> itk::ExposeMetaData(*inputDict, "0020|000d", studyUID); >> >> itk::ExposeMetaData(*inputDict, "0008|0016", sopClassUID); >> >> gdcmIO->KeepOriginalUIDOn(); >> >> >> >> using namespace std; >> >> double myArray_Z[70]; //Cambiar esto por un argumento que especifica la >> cantidad de imagenes. >> >> double myArray_X[70]; //Cambiar esto por un argumento que especifica la >> cantidad de imagenes. >> >> double myArray_Y[70]; //Cambiar esto por un argumento que especifica la >> cantidad de imagenes. >> >> >> >> ifstream file("file.txt"); >> >> if (file.is_open()) >> >> { >> >> for (int i = 0; i < 70; ++i) //Recordar cambiar por el argumento que >> especifica cantidad de imagenes >> >> { >> >> file >> myArray_Z[i]; >> >> } >> >> } >> >> std::cout << "valor primer Z array: " << std::endl << std::endl; >> >> std::cout << myArray_Z[0] << std::endl; >> >> >> >> for (unsigned int f = 0; f < inputSize[2]; f++) >> >> { >> >> // Create a new dictionary for this slice >> >> ReaderType::DictionaryRawPointer dict = new ReaderType::DictionaryType; >> >> >> >> // Copy the dictionary from the first slice >> >> CopyDictionary(*inputDict, *dict); >> >> >> >> // Set the UID's for the study, series, SOP and frame of reference >> >> itk::EncapsulateMetaData(*dict, "0020|000d", studyUID); >> >> //itk::EncapsulateMetaData(*dict, "0020|000e", seriesUID); >> >> itk::EncapsulateMetaData(*dict, "0020|0052", >> frameOfReferenceUID); >> >> >> >> gdcm::UIDGenerator sopuid; >> >> std::string sopInstanceUID = sopuid.Generate(); >> >> >> >> itk::EncapsulateMetaData(*dict, "0008|0018", >> sopInstanceUID); >> >> itk::EncapsulateMetaData(*dict, "0002|0003", >> sopInstanceUID); >> >> >> >> // Change fields that are slice specific >> >> std::ostringstream value; >> >> value.str(""); >> >> value << f + 1; >> >> >> >> // Image Number >> >> itk::EncapsulateMetaData(*dict, "0020|0013", value.str()); >> >> >> >> // Series Description - Append new description to current series >> >> // description >> >> std::string oldSeriesDesc; >> >> itk::ExposeMetaData(*inputDict, "0008|103e", oldSeriesDesc); >> >> >> >> value.str(""); >> >> value << oldSeriesDesc >> >> << ": Resampled with pixel spacing " >> >> << inputSpacing[0] << ", " >> >> << inputSpacing[1] << ", " >> >> << inputSpacing[2]; >> >> // This is an long string and there is a 64 character limit in the >> >> // standard >> >> unsigned lengthDesc = value.str().length(); >> >> >> >> std::string seriesDesc(value.str(), 0, >> >> lengthDesc > 64 ? 64 >> >> : lengthDesc); >> >> itk::EncapsulateMetaData(*dict, "0008|103e", seriesDesc); >> >> >> >> // Series Number >> >> value.str(""); >> >> value << 1001; >> >> itk::EncapsulateMetaData(*dict, "0020|0011", value.str()); >> >> >> >> // Derivation Description - How this image was derived >> >> value.str(""); >> >> for (int i = 0; i < argc; i++) >> >> { >> >> value << argv[i] << " "; >> >> } >> >> >> >> lengthDesc = value.str().length(); >> >> std::string derivationDesc(value.str(), 0, >> >> lengthDesc > 1024 ? 1024 >> >> : lengthDesc); >> >> itk::EncapsulateMetaData(*dict, "0008|2111", >> derivationDesc); >> >> >> >> // Image Position Patient: This is calculated by computing the >> >> // physical coordinate of the first pixel in each slice. >> >> ImageType::PointType position; >> >> ImageType::IndexType index; >> >> index[0] = 0; >> >> index[1] = 0; >> >> index[2] = myArray_Z[f]; >> >> FiltroResample->GetOutput()->TransformIndexToPhysicalPoint(index, >> position); >> >> >> >> //El origen que calculamos en el proyecto no se toca. (Origen = origen - >> average) >> >> >> >> //Cambiamos el ImageOrientationPatient SOLAMENTE si el valor original en >> la imagen es: 1\0\0\0\1\0. En el caso que se cambia el signo, se debe >> cambiar el signo del origen >> >> //value.str(""); >> >> //value << -1 << "\\" << 0 << "\\" << 0 << "\\" << 0 << "\\" << -1 << >> "\\" << 0; //PASAR ESTO POR ARGUMENTO!!! >> >> //itk::EncapsulateMetaData(*dict, "0020|0037", value.str()); >> >> >> >> value.str(""); >> >> value << -235.1629 << "\\" << -195.0557 << "\\" << myArray_Z[f]; //PASAR >> ESTO POR ARGUMENTO!!! El origen - Centro >> >> itk::EncapsulateMetaData(*dict, "0020|0032", value.str()); >> >> >> >> >> >> // Slice Location: For now, we store the z component of the Image >> >> // Position Patient. >> >> value.str(""); >> >> value << position[2]; >> >> itk::EncapsulateMetaData(*dict, "0020|1041", value.str()); >> >> >> >> // Slice Thickness: For now, we store the z spacing >> >> value.str(""); >> >> value << inputSpacing[2]; >> >> itk::EncapsulateMetaData(*dict, "0018|0050", >> >> value.str()); >> >> // Spacing Between Slices >> >> itk::EncapsulateMetaData(*dict, "0018|0088", >> >> value.str()); >> >> >> >> // Save the dictionary >> >> outputArray.push_back(dict); >> >> } >> >> >> >> >> >> typedef itk::ImageFileWriter< ImageType > WriterType; >> >> WriterType::Pointer writer = WriterType::New(); >> >> >> >> typedef itk::ImageSeriesWriter< ImageType, ImageType_Serie > >> SeriesWriterType; >> >> SeriesWriterType::Pointer seriesWriter = SeriesWriterType::New(); >> >> seriesWriter->SetInput(FiltroResample->GetOutput()); >> >> >> >> writer->SetFileName(argv[2]); >> >> writer->SetInput(FiltroResample->GetOutput()); >> >> >> >> itksys::SystemTools::MakeDirectory("Test"); //PASAR ESTO POR ARGUMENTO!! >> >> typedef itk::NumericSeriesFileNames OutputNamesGeneratorType; >> >> OutputNamesGeneratorType::Pointer outputNames = >> OutputNamesGeneratorType::New(); >> >> std::string seriesFormat("Test"); //PASAR ESTO POR ARGUMENTO!! >> >> seriesFormat = seriesFormat + "/" + "IM%d.dcm"; >> >> outputNames->SetSeriesFormat(seriesFormat.c_str()); >> >> outputNames->SetStartIndex(1); >> >> outputNames->SetEndIndex(inputSize[2]); >> >> >> >> seriesWriter->SetImageIO(gdcmIO); >> >> seriesWriter->SetFileNames(outputNames->GetFileNames()); >> >> seriesWriter->SetMetaDataDictionaryArray(&outputArray); >> >> >> >> std::cout << "Escribiendo la imagen como..." << std::endl << std::endl; >> >> std::cout << argv[2] << std::endl << std::endl; >> >> >> >> try >> >> { >> >> writer->Update(); >> >> seriesWriter->Update(); >> >> } >> >> catch (itk::ExceptionObject &ex) >> >> { >> >> std::cout << ex << std::endl; >> >> return EXIT_FAILURE; >> >> } >> >> >> >> >> >> } >> >> catch (itk::ExceptionObject &ex) >> >> { >> >> std::cout << ex << std::endl; >> >> return EXIT_FAILURE; >> >> } >> >> >> >> return EXIT_SUCCESS; >> >> >> >> } >> >> >> >> void CopyDictionary(itk::MetaDataDictionary &fromDict, >> itk::MetaDataDictionary &toDict) >> >> { >> >> typedef itk::MetaDataDictionary DictionaryType; >> >> >> >> DictionaryType::ConstIterator itr = fromDict.Begin(); >> >> DictionaryType::ConstIterator end = fromDict.End(); >> >> typedef itk::MetaDataObject< std::string > MetaDataStringType; >> >> >> >> while (itr != end) >> >> { >> >> itk::MetaDataObjectBase::Pointer entry = itr->second; >> >> >> >> MetaDataStringType::Pointer entryvalue = >> >> dynamic_cast(entry.GetPointer()); >> >> if (entryvalue) >> >> { >> >> std::string tagkey = itr->first; >> >> std::string tagvalue = entryvalue->GetMetaDataObjectValue(); >> >> itk::EncapsulateMetaData(toDict, tagkey, tagvalue); >> >> } >> >> ++itr; >> >> } >> >> } >> >> >> >> >> >> El jue., 30 de mar. de 2017 a la(s) 11:25, Lowekamp, Bradley >> (NIH/NLM/LHC) [C] [via ITK - Users] <[hidden email]> escribi?: >> >> Hello, >> >> Writing correct DICOM continues to be a struggle with SimpleITK and ITK. >> It is generally recommended to directly use GDCM or DCMTK to write a proper >> DICOM series. >> >> SimpleITK tries to keep things, well, simple and straight forward. But >> ITK ties to do some smart things, which get in the way for certain uses >> with SimpleITK. We are trying to document and develop a nominal set of >> DICOM output operations that work in SimpleITK. >> >> Do you have working C++ code that works for your intended operation? Can >> you share a small section of code which does what you expect it C++? >> >> Thank, >> Brad >> >> >> >> > On Mar 30, 2017, at 8:49 AM, Matias <[hidden email] >> > wrote: >> > >> > Hi, >> > >> > I've been dealing with ITK for years in C++ and now I would need to use >> > SimpleITK and C# as far as I can in a new proyect. >> > >> > Is the SimpleITK SeriesWriter working for Dicom Files? Last time I >> tried to >> > use it I had problems with the DicomTags, these would not copy or there >> was >> > no method to copy the tags to the resulting slices. >> > >> > Currently, I read a volume of slices, apply rotation and then I need to >> > write the resulting image as another set of slices AND keeping tag >> > information such as patient name, etc. >> > >> > Thank you, >> > >> > Matias. >> > >> > >> > >> > -- >> > View this message in context: http://itk-users.7.n7.nabble. >> com/SimpleITK-Serieswriter-and-DicomTags-tp38050.html >> > Sent from the ITK - 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 >> > _______________________________________________ >> > Community mailing list >> >> > [hidden email] >> > http://public.kitware.com/mailman/listinfo/community >> >> >> _____________________________________ >> 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 >> >> ------------------------------ >> >> *If you reply to this email, your message will be added to the discussion >> below:* >> >> http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter- >> and-DicomTags-tp38050p38052.html >> >> To unsubscribe from SimpleITK Serieswriter and DicomTags, click here. >> NAML >> >> >> -- >> >> Matias >> >> >> ------------------------------ >> >> View this message in context: Re: [ITK-users] [ITK] SimpleITK >> Serieswriter and DicomTags >> >> >> >> Sent from the ITK - 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 >> >> >> If you reply to this email, your message will be added to the discussion >> below: >> http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter- >> and-DicomTags-tp38050p38063.html >> To unsubscribe from SimpleITK Serieswriter and DicomTags, click here. >> NAML >> >> > -- > Matias > > ------------------------------ > View this message in context: Re: [ITK-users] [ITK] SimpleITK > Serieswriter and DicomTags > > Sent from the ITK - 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From zivrafael.yaniv at nih.gov Sun Apr 2 09:58:47 2017 From: zivrafael.yaniv at nih.gov (Yaniv, Ziv Rafael (NIH/NLM/LHC) [C]) Date: Sun, 2 Apr 2017 13:58:47 +0000 Subject: [ITK] [ITK-users] SimpleITK Serieswriter and DicomTags In-Reply-To: References: <1490878156334-38050.post@n7.nabble.com> <031C16D1-4B43-4BD8-9C80-91A2F9C72B6B@mail.nih.gov> <54518069-C5F9-445E-983C-FDD5A2EDA798@mail.nih.gov> Message-ID: <89767550-AE53-4FCB-81F0-66A709E3253F@mail.nih.gov> Hi Matias, We should get it into the main SimpleITK repository shortly (after testing etc..). For now please follow D?enan?s recommendation (clone my forked repository, checkout the dicomWrite branch and build SimpleITK from that branch). regards Ziv From: D?enan Zuki? Date: Saturday, April 1, 2017 at 9:37 AM To: Matias Cc: Insight-users Subject: Re: [ITK-users] [ITK] SimpleITK Serieswriter and DicomTags Hi Matias, you should use branch dicomWrite from Ziv's fork. Regards, D?enan On Sat, Apr 1, 2017 at 2:48 AM, Matias > wrote: Thanks Yaniv. So how do I get this branch? I simply download the latest version of SimpleITK? El vie., 31 de mar. de 2017 a la(s) 19:18, Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] [via ITK - Users] <[hidden email]> escribi?: Hello Matias, Please take a look at the following github pull request (https://github.com/SimpleITK/SimpleITK/pull/134), this branch should provide the functionality you are looking for. See the Python example script included in the commit for the usage of the DICOM series writing. hope this helps Ziv From: Matias <[hidden email]> Date: Thursday, March 30, 2017 at 12:14 PM To: "[hidden email]" <[hidden email]> Subject: Re: [ITK-users] [ITK] SimpleITK Serieswriter and DicomTags Yes, this is what I would need to migrate to C#: It basically reads a dicom directory and performs rotation on the volume, then writes the resulting images back to a directory, copying the tags from the original images. #include "itkImage.h" #include "itkGDCMImageIO.h" #include "itkGDCMSeriesFileNames.h" #include "itkImageSeriesReader.h" #include "itkResampleImageFilter.h" #include "itkEuler3DTransform.hxx" #include "gdcmUIDGenerator.h" #include "itkImageFileWriter.h" #include "itkImageSeriesWriter.h" #include "itkNumericSeriesFileNames.h" #include "itkTranslationTransform.h" #include "string.h"; #include #include #include #include static void CopyDictionary(itk::MetaDataDictionary &fromDict, itk::MetaDataDictionary &toDict); int main(int argc, char* argv[]) { if (argc < 8) { std::cerr << "Uso: " << std::endl; std::cerr << argv[0] << " Directorio_A_Rotar DirectorioResultante Gamma Beta Alfa CentroRotacionX CentroRotacionY CentroRotacionZ" << std::endl; return EXIT_FAILURE; } typedef signed short PixelType; const unsigned int Dimension = 3; const unsigned int Dimension_Serie = 2; typedef itk::Image< PixelType, Dimension > ImageType; typedef itk::Image ImageType_Serie; typedef itk::ImageSeriesReader< ImageType > ReaderType; ReaderType::Pointer reader = ReaderType::New(); typedef itk::GDCMImageIO ImageIOType; ImageIOType::Pointer gdcmIO = ImageIOType::New(); reader->SetImageIO(gdcmIO); typedef itk::GDCMSeriesFileNames NamesGeneratorType; NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New(); nameGenerator->SetUseSeriesDetails(true); nameGenerator->AddSeriesRestriction("0008|0021"); nameGenerator->SetDirectory(argv[1]); try { std::cout << std::endl << "The directory: " << std::endl; std::cout << std::endl << argv[1] << std::endl << std::endl; std::cout << "Contains the following DICOM Series: "; std::cout << std::endl << std::endl; typedef std::vector< std::string > SeriesIdContainer; const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs(); SeriesIdContainer::const_iterator seriesItr = seriesUID.begin(); SeriesIdContainer::const_iterator seriesEnd = seriesUID.end(); while (seriesItr != seriesEnd) { std::cout << seriesItr->c_str() << std::endl; ++seriesItr; } std::string seriesIdentifier; seriesIdentifier = seriesUID.begin()->c_str(); std::cout << std::endl << std::endl; std::cout << "Now reading series: " << std::endl << std::endl; std::cout << seriesIdentifier << std::endl; std::cout << std::endl << std::endl; typedef std::vector< std::string > FileNamesContainer; FileNamesContainer fileNames; fileNames = nameGenerator->GetFileNames(seriesIdentifier); reader->SetFileNames(fileNames); try { reader->Update(); } catch (itk::ExceptionObject &ex) { std::cout << ex << std::endl; return EXIT_FAILURE; } const ImageType * inputImage = reader->GetOutput(); /*int numerodedicoms = inputImage->GetLargestPossibleRegion().GetSize()[2]; int dicomcentral = numerodedicoms / 2; std::cout << "Dimenion " << dicomcentral << std::endl;*/ //itk::EncapsulateMetaData(dictionary, "0020|0032","-208\\-236\\66"); typedef itk::ResampleImageFilter FilterType; FilterType::Pointer FiltroResample = FilterType::New(); FiltroResample->SetInput(reader->GetOutput()); typedef itk::LinearInterpolateImageFunction InterpolatorType; InterpolatorType::Pointer interpolator = InterpolatorType::New(); FiltroResample->SetInterpolator(interpolator); FiltroResample->SetOutputDirection(inputImage->GetDirection()); FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); ImageType::SizeType inputSize = inputImage->GetLargestPossibleRegion().GetSize(); FiltroResample->SetSize(inputSize); const ImageType::SpacingType& inputSpacing = inputImage->GetSpacing(); FiltroResample->SetOutputSpacing(inputSpacing); FiltroResample->SetDefaultPixelValue(-1000); //Cambiar por un parametro typedef itk::Euler3DTransform< double > TransformType; //Transform TransformType::Pointer transform = TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z; gamma = atof(argv[3]); beta= atof(argv[4]); alfa = atof(argv[5]); centro_rotacion_X = atof(argv[6]); centro_rotacion_Y = atof(argv[7]); centro_rotacion_Z = atof(argv[8]); transform->SetRotation(gamma, beta, alfa); //Radianes en el siguiente orden en ITK: Gamma, Beta, Alfa | Ibarra //double centro[3] = { -14.8371, -54.9443, 175.75 }; //XmmPromedio, YmmPromedio, Z Central (mm): Leer directorio y tomar la del medio double centro[3] = { centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z }; //XmmPromedio, YmmPromedio, Z Central (mm): Leer directorio y tomar la del medio transform->SetCenter(centro); std::cout << "Centro: " << std::endl << std::endl; std::cout << transform->GetCenter() << std::endl; FiltroResample->SetTransform(transform); //FiltroResample->SetMetaDataDictionary(dictionary); try { FiltroResample->Update(); } catch (itk::ExceptionObject &ex) { return EXIT_FAILURE; } ReaderType::DictionaryRawPointer inputDict = (*(reader->GetMetaDataDictionaryArray()))[0]; ReaderType::DictionaryArrayType outputArray; //std::cout << "array: " << std::endl << outputArray[0] << std::endl; // To keep the new series in the same study as the original we need // to keep the same study UID. But we need new series and frame of // reference UID's. gdcm::UIDGenerator suid; //std::string seriesUID = suid.Generate(); gdcm::UIDGenerator fuid; std::string frameOfReferenceUID = fuid.Generate(); std::string studyUID; std::string sopClassUID; itk::ExposeMetaData(*inputDict, "0020|000d", studyUID); itk::ExposeMetaData(*inputDict, "0008|0016", sopClassUID); gdcmIO->KeepOriginalUIDOn(); using namespace std; double myArray_Z[70]; //Cambiar esto por un argumento que especifica la cantidad de imagenes. double myArray_X[70]; //Cambiar esto por un argumento que especifica la cantidad de imagenes. double myArray_Y[70]; //Cambiar esto por un argumento que especifica la cantidad de imagenes. ifstream file("file.txt"); if (file.is_open()) { for (int i = 0; i < 70; ++i) //Recordar cambiar por el argumento que especifica cantidad de imagenes { file >> myArray_Z[i]; } } std::cout << "valor primer Z array: " << std::endl << std::endl; std::cout << myArray_Z[0] << std::endl; for (unsigned int f = 0; f < inputSize[2]; f++) { // Create a new dictionary for this slice ReaderType::DictionaryRawPointer dict = new ReaderType::DictionaryType; // Copy the dictionary from the first slice CopyDictionary(*inputDict, *dict); // Set the UID's for the study, series, SOP and frame of reference itk::EncapsulateMetaData(*dict, "0020|000d", studyUID); //itk::EncapsulateMetaData(*dict, "0020|000e", seriesUID); itk::EncapsulateMetaData(*dict, "0020|0052", frameOfReferenceUID); gdcm::UIDGenerator sopuid; std::string sopInstanceUID = sopuid.Generate(); itk::EncapsulateMetaData(*dict, "0008|0018", sopInstanceUID); itk::EncapsulateMetaData(*dict, "0002|0003", sopInstanceUID); // Change fields that are slice specific std::ostringstream value; value.str(""); value << f + 1; // Image Number itk::EncapsulateMetaData(*dict, "0020|0013", value.str()); // Series Description - Append new description to current series // description std::string oldSeriesDesc; itk::ExposeMetaData(*inputDict, "0008|103e", oldSeriesDesc); value.str(""); value << oldSeriesDesc << ": Resampled with pixel spacing " << inputSpacing[0] << ", " << inputSpacing[1] << ", " << inputSpacing[2]; // This is an long string and there is a 64 character limit in the // standard unsigned lengthDesc = value.str().length(); std::string seriesDesc(value.str(), 0, lengthDesc > 64 ? 64 : lengthDesc); itk::EncapsulateMetaData(*dict, "0008|103e", seriesDesc); // Series Number value.str(""); value << 1001; itk::EncapsulateMetaData(*dict, "0020|0011", value.str()); // Derivation Description - How this image was derived value.str(""); for (int i = 0; i < argc; i++) { value << argv[i] << " "; } lengthDesc = value.str().length(); std::string derivationDesc(value.str(), 0, lengthDesc > 1024 ? 1024 : lengthDesc); itk::EncapsulateMetaData(*dict, "0008|2111", derivationDesc); // Image Position Patient: This is calculated by computing the // physical coordinate of the first pixel in each slice. ImageType::PointType position; ImageType::IndexType index; index[0] = 0; index[1] = 0; index[2] = myArray_Z[f]; FiltroResample->GetOutput()->TransformIndexToPhysicalPoint(index, position); //El origen que calculamos en el proyecto no se toca. (Origen = origen - average) //Cambiamos el ImageOrientationPatient SOLAMENTE si el valor original en la imagen es: 1\0\0\0\1\0. En el caso que se cambia el signo, se debe cambiar el signo del origen //value.str(""); //value << -1 << "\\" << 0 << "\\" << 0 << "\\" << 0 << "\\" << -1 << "\\" << 0; //PASAR ESTO POR ARGUMENTO!!! //itk::EncapsulateMetaData(*dict, "0020|0037", value.str()); value.str(""); value << -235.1629 << "\\" << -195.0557 << "\\" << myArray_Z[f]; //PASAR ESTO POR ARGUMENTO!!! El origen - Centro itk::EncapsulateMetaData(*dict, "0020|0032", value.str()); // Slice Location: For now, we store the z component of the Image // Position Patient. value.str(""); value << position[2]; itk::EncapsulateMetaData(*dict, "0020|1041", value.str()); // Slice Thickness: For now, we store the z spacing value.str(""); value << inputSpacing[2]; itk::EncapsulateMetaData(*dict, "0018|0050", value.str()); // Spacing Between Slices itk::EncapsulateMetaData(*dict, "0018|0088", value.str()); // Save the dictionary outputArray.push_back(dict); } typedef itk::ImageFileWriter< ImageType > WriterType; WriterType::Pointer writer = WriterType::New(); typedef itk::ImageSeriesWriter< ImageType, ImageType_Serie > SeriesWriterType; SeriesWriterType::Pointer seriesWriter = SeriesWriterType::New(); seriesWriter->SetInput(FiltroResample->GetOutput()); writer->SetFileName(argv[2]); writer->SetInput(FiltroResample->GetOutput()); itksys::SystemTools::MakeDirectory("Test"); //PASAR ESTO POR ARGUMENTO!! typedef itk::NumericSeriesFileNames OutputNamesGeneratorType; OutputNamesGeneratorType::Pointer outputNames = OutputNamesGeneratorType::New(); std::string seriesFormat("Test"); //PASAR ESTO POR ARGUMENTO!! seriesFormat = seriesFormat + "/" + "IM%d.dcm"; outputNames->SetSeriesFormat(seriesFormat.c_str()); outputNames->SetStartIndex(1); outputNames->SetEndIndex(inputSize[2]); seriesWriter->SetImageIO(gdcmIO); seriesWriter->SetFileNames(outputNames->GetFileNames()); seriesWriter->SetMetaDataDictionaryArray(&outputArray); std::cout << "Escribiendo la imagen como..." << std::endl << std::endl; std::cout << argv[2] << std::endl << std::endl; try { writer->Update(); seriesWriter->Update(); } catch (itk::ExceptionObject &ex) { std::cout << ex << std::endl; return EXIT_FAILURE; } } catch (itk::ExceptionObject &ex) { std::cout << ex << std::endl; return EXIT_FAILURE; } return EXIT_SUCCESS; } void CopyDictionary(itk::MetaDataDictionary &fromDict, itk::MetaDataDictionary &toDict) { typedef itk::MetaDataDictionary DictionaryType; DictionaryType::ConstIterator itr = fromDict.Begin(); DictionaryType::ConstIterator end = fromDict.End(); typedef itk::MetaDataObject< std::string > MetaDataStringType; while (itr != end) { itk::MetaDataObjectBase::Pointer entry = itr->second; MetaDataStringType::Pointer entryvalue = dynamic_cast(entry.GetPointer()); if (entryvalue) { std::string tagkey = itr->first; std::string tagvalue = entryvalue->GetMetaDataObjectValue(); itk::EncapsulateMetaData(toDict, tagkey, tagvalue); } ++itr; } } El jue., 30 de mar. de 2017 a la(s) 11:25, Lowekamp, Bradley (NIH/NLM/LHC) [C] [via ITK - Users] <[hidden email]> escribi?: Hello, Writing correct DICOM continues to be a struggle with SimpleITK and ITK. It is generally recommended to directly use GDCM or DCMTK to write a proper DICOM series. SimpleITK tries to keep things, well, simple and straight forward. But ITK ties to do some smart things, which get in the way for certain uses with SimpleITK. We are trying to document and develop a nominal set of DICOM output operations that work in SimpleITK. Do you have working C++ code that works for your intended operation? Can you share a small section of code which does what you expect it C++? Thank, Brad > On Mar 30, 2017, at 8:49 AM, Matias <[hidden email]> wrote: > > Hi, > > I've been dealing with ITK for years in C++ and now I would need to use > SimpleITK and C# as far as I can in a new proyect. > > Is the SimpleITK SeriesWriter working for Dicom Files? Last time I tried to > use it I had problems with the DicomTags, these would not copy or there was > no method to copy the tags to the resulting slices. > > Currently, I read a volume of slices, apply rotation and then I need to > write the resulting image as another set of slices AND keeping tag > information such as patient name, etc. > > Thank you, > > Matias. > > > > -- > View this message in context: http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050.html > Sent from the ITK - 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 > _______________________________________________ > Community mailing list > [hidden email] > http://public.kitware.com/mailman/listinfo/community _____________________________________ 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 ________________________________ If you reply to this email, your message will be added to the discussion below: http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050p38052.html To unsubscribe from SimpleITK Serieswriter and DicomTags, click here. NAML -- Matias ________________________________ View this message in context: Re: [ITK-users] [ITK] SimpleITK Serieswriter and DicomTags Sent from the ITK - 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 If you reply to this email, your message will be added to the discussion below: http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050p38063.html To unsubscribe from SimpleITK Serieswriter and DicomTags, click here. NAML -- Matias ________________________________ View this message in context: Re: [ITK-users] [ITK] SimpleITK Serieswriter and DicomTags Sent from the ITK - 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From fisidoro at ethz.ch Sun Apr 2 17:17:50 2017 From: fisidoro at ethz.ch (D'Isidoro Fabio) Date: Sun, 2 Apr 2017 21:17:50 +0000 Subject: [ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa) Message-ID: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> Hallo, I use ITK with Python Wrap. I need to interface my Python code with a Cython-wrapped C++ code that takes only numpy array as input and returns numpy array as output. Hence, I need to convert the Python itk images into numpy array to be given as input to the wrapped C++ code, and then convert the numpy array in output from the wrapped C++ code back into python itk images. Question 1) How can I do that in an efficient way? I found some posts on itk.PyBuffer but I could not find anywhere any reference on how to install it on my itk wrap build. Question 2) The purpose of writing a part of my algorithm in C++ is to speed up the code. If the conversion between python itk images and numpy arrays is slow, I would lose all the speed gain obtained with the C++ implementation. Are there better ways to deal with that? Thank you, Fabio. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matt.mccormick at kitware.com Mon Apr 3 14:40:50 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Mon, 3 Apr 2017 14:40:50 -0400 Subject: [ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa) In-Reply-To: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> Message-ID: Hallo Fabio, > I use ITK with Python Wrap. I need to interface my Python code with a > Cython-wrapped C++ code that takes only numpy array as input and returns > numpy array as output. Cool. By the way, you may be interested in scikit-build [1], which is a good way to build Cython-wrapped C++ code. We are using it for the ITK and SimpleITK Python packages, and it has good Cython and CMake support. > Hence, I need to convert the Python itk images into numpy array to be given > as input to the wrapped C++ code, and then convert the numpy array in output > from the wrapped C++ code back into python itk images. > > > > Question 1) How can I do that in an efficient way? I found some posts on > itk.PyBuffer but I could not find anywhere any reference on how to install > it on my itk wrap build. Yes, itk.PyBuffer works great for that. Please review a PR for some additional documentation: https://github.com/InsightSoftwareConsortium/ITKBridgeNumPy/pull/18 This has been available in ITK for a few releases as a Remote module, which can be enabled by setting Module_BridgeNumPy=ON in ITK's CMake configuration. Since ITK 4.11.0, it is easier to build since it does not require the NumPy headers. In current ITK Git master (to be 4.12.0) the module is enabled by default. Nightly ITK Python packages for ITK Git master are now being built: https://github.com/InsightSoftwareConsortium/ITKPythonPackage macOS and Linux are available. Windows packages will be available over the coming weeks. > Question 2) The purpose of writing a part of my algorithm in C++ is to speed > up the code. If the conversion between python itk images and numpy arrays is > slow, I would lose all the speed gain obtained with the C++ implementation. > Are there better ways to deal with that? The newer versions ITKBridgeNumPy use a NumPy array view, which does not do any copies during the conversion, and it is very fast. HTH, Matt [1] http://scikit-build.org/ _____________________________________ 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 From matt.mccormick at kitware.com Mon Apr 3 15:18:03 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Mon, 3 Apr 2017 15:18:03 -0400 Subject: [ITK] [ITK-users] Patch for ApproximateSignedDistanceMapImageFilter In-Reply-To: References: <874f690f-ff74-bb01-6d1e-bc479abeb547@neuro.ma.uni-heidelberg.de> Message-ID: Hi Christina, > 2nd attempt using approach 1) (see below). What about typos in comments I > removed during bug fixing? Include into this patch as well or keep them > separate? Thanks! This patch has been uploaded: http://review.source.kitware.com/#/c/22149/3 The typos could go in a different patch (ideally), but it is OK, if they are included. Thanks, Matt > Additionally you find a small application creating an image with a bright > square on dark background which displays the image together with the result > of ApproximateSignedDistanceMapImageFilter. The pixel value of the square is > 1 by default but can be changed via command line. > > Regards, > Christina > > > On 29.03.2017 15:12, Francois Budin wrote: > > Hello Christina, > > I see different paths to try to solve this issue and I am not sure which one > is the best one: > 1) You could modify the itkIsoContourDistanceImageFilter class so that > m_LevelSetValue is of some real type. When looking in the implementation of > this filter, you can see that sometimes, m_LevelSetValue is casted to a > real type [1], so maybe it makes sense to do that. > 2) Casting is one solution, but you have to be careful if you want to cast > to float or double. If you cast to float, and the input is of type double, > you will loose precision. If you always cast to double, you might use a lot > of memory. Sadly, in the itkNumericTraits, there is no way of asking for > "the smallest floating type that contains my current type". You can call > "RealType" which will be "double", or "FloatType" which will be float. One > strength of casting, is that if you perform it in place, it can actually not > do anything if it doesn't need to [2]. > 3) To avoid casting when you don't need to (your type is float or double), > you could use the SFINAE concept like it is used here [3]. This is more > complex and may not be worth it. > > Beware that images may contain pixels that are not only scalar values, but > also RGB, RGBA, vectors. I am not sure if the ApproximateDistance filter > supports these types, but it is good to be careful, when modifying the code, > to not restrict the usage of a filter to scalar if not required. To avoid > that kind of issues, and to answer your original question, you can use the > Rebind structure [4]. > > I hope this helps. > I will be out of town for a week, and most likely will have limited to no > access to the internet, so don't be surprised if I do not answer your next > message within the next week. > > Thanks for helping! > Francois > > [1] > https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx#L314 > [2] > https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/ImageFilterBase/include/itkCastImageFilter.hxx#L42 > [3] > https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/IO/ImageBase/include/itkConvertPixelBuffer.h#L153-L161 > [4] > https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/Smoothing/include/itkSmoothingRecursiveGaussianImageFilter.h#L84-L85 > > On Wed, Mar 29, 2017 at 7:10 AM, Chr. Rossmanith > wrote: >> >> Hi Francois, >> >> I'm getting back to this issue. I'll introduce an intermediate image in >> the mini pipeline used in ApproximateSignedDistanceMapImageFilter which has >> a floating type for pixel values. Given >> >> /** Type for input image. */ >> typedef TInputImage InputImageType; >> >> how can I define a corresponding image type FloatImageType replacing the >> unknown pixel type by float? I can't write itk::Image< float, xxx > because >> I don't know xxx. >> >> Is there a way to query the pixel type to avoid applying the >> CastImageFilter in case we already get floating valued pixels? >> >> Christina >> >> >> >> On 03.03.2017 14:58, Francois Budin wrote: >> >> Hi Christina, >> >> Maybe your idea was good but needs more work (e.g. cast the input image to >> the output type? at least if input is not a float, or maybe something else). >> I am glad you found a solution that works for you. If you need your software >> to be faster, you can also replace the SignedDanielssonDistanceMap with the >> SignedMauerDistanceMap [1]. >> >> Hope this helps, and thanks for your contribution. Do not hesitate to >> submit a new patch to solve your original problem if you find a solution. >> >> Francois >> [1] >> https://itk.org/Doxygen/html/classitk_1_1SignedMaurerDistanceMapImageFilter.html >> >> On Fri, Mar 3, 2017 at 8:23 AM, Chr. Rossmanith >> wrote: >>> >>> Hi Francois, >>> >>> really strange, on Wednesday changing the data type made my application >>> work as expected (but obviously there must have been an additional change >>> which really made the application work...). When trying to build a small >>> example for you, I failed. I still think that feeding a 0/1 image into >>> ApproximateSignedDistanceMapImageFilter makes sense. >>> >>> Originally I'm interested in ContourExtractor2D, which operates on a >>> distance map using 0 as contour level. Unlike in the ContourExtractor2D >>> example I've decided to use SignedDanielssonDistanceMap which works fine >>> without any patches. >>> >>> So send the patch to /dev/null for the moment... >>> >>> Christina >>> >>> >>> On 02.03.2017 16:17, Francois Budin wrote: >>> >>> Hello Christina, >>> >>> I just reviewed you patch. You are changing the type of the variable >>> levelSetValue to OutputPixelType which is suppose to be a floating point >>> value. >>> However, the computation is done with InputPixelType variables >>> (m_InsideValue and m_OutsideValue) and divided by an integer. Additionally, >>> the resulting value is used in: >>> m_IsoContourFilter->SetLevelSetValue(levelSetValue); >>> >>> which accepts values of InputPixelType [1] since IsoContourType is >>> defined as: >>> typedef IsoContourDistanceImageFilter< InputImageType, OutputImageType >>> > IsoContourType; >>> >>> I am not sure if your patch solves the problem that you mentioned. Do you >>> have a test that would verify that the new behavior corresponds to your >>> expectations? Based on the code review I have done, I would not expect the >>> behavior of the filter to change. >>> >>> Let me know if I missed a detail. Thank you for your contribution! >>> Francois >>> >>> [1] >>> https://itk.org/Doxygen/html/classitk_1_1IsoContourDistanceImageFilter.html >>> >>> On Wed, Mar 1, 2017 at 8:12 AM, Chr. Rossmanith >>> wrote: >>>> >>>> For binary images with 0 for background and 1 for objects with an >>>> integer input pixel type there is a problem representing the average of 0 >>>> and 1 = 0.5 with the input pixel type. The output pixel type is required to >>>> be a floating pixel type (filter documentation), so it should be safe to >>>> change the type of levelSetValue to OutputPixelType. >>>> >>>> Regards, >>>> Christina >>>> >>>> >>>> _____________________________________ >>>> 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 >>>> >>> >>> >> >> > > > > _____________________________________ > 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 > _____________________________________ 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 From matt.mccormick at kitware.com Mon Apr 3 15:19:07 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Mon, 3 Apr 2017 15:19:07 -0400 Subject: [ITK] [ITK-users] Otsu Filter in Statistic and Review/statistics In-Reply-To: References: Message-ID: Hi Zein, It sounds like this is ITKv3. A number of Otsu fixes have been made in ITKv4 - upgrading will likely fix the issue. HTH, Matt On Fri, Mar 31, 2017 at 4:42 AM, Zein Salah wrote: > Hi, > > I had a strange behavior regarding otsu filter. My code is as simple as > this: > > > typedef itk::Statistics::ScalarImageToHistogramGenerator > ScalarImageToHistogramGeneratorType; > typedef ScalarImageToHistogramGeneratorType::HistogramType > HistogramType; > typedef itk::OtsuMultipleThresholdsCalculator > OtsuCalculatorType; > > ScalarImageToHistogramGeneratorType::Pointer > scalarImageToHistogramGenerator = > ScalarImageToHistogramGeneratorType::New(); > scalarImageToHistogramGenerator->SetNumberOfBins(128); > scalarImageToHistogramGenerator->SetInput(itkImage); > scalarImageToHistogramGenerator->Compute(); > > > OtsuCalculatorType::Pointer otsuCalculator = OtsuCalculatorType::New(); > otsuCalculator->SetNumberOfThresholds(numberOfThresholds); > > otsuCalculator->SetInputHistogram(scalarImageToHistogramGenerator->GetOutput()); > otsuCalculator->Update(); > > const OtsuCalculatorType::OutputType& thresholdVector = > otsuCalculator->GetOutput(); > HistogramType::MeasurementType threshold = > thresholdVector[usedThreshold]; > > > I tested this with itk configured with ITK_USE_REVIEW_STATISTICS set to ON > and once to OFF. > With some images, the results is not the same. > > Is this a known issue? > > thanks, > Zein > > _____________________________________ > 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 > _____________________________________ 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 From matt.mccormick at kitware.com Mon Apr 3 15:19:07 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Mon, 3 Apr 2017 15:19:07 -0400 Subject: [ITK] [ITK-users] Otsu Filter in Statistic and Review/statistics In-Reply-To: References: Message-ID: Hi Zein, It sounds like this is ITKv3. A number of Otsu fixes have been made in ITKv4 - upgrading will likely fix the issue. HTH, Matt On Fri, Mar 31, 2017 at 4:42 AM, Zein Salah wrote: > Hi, > > I had a strange behavior regarding otsu filter. My code is as simple as > this: > > > typedef itk::Statistics::ScalarImageToHistogramGenerator > ScalarImageToHistogramGeneratorType; > typedef ScalarImageToHistogramGeneratorType::HistogramType > HistogramType; > typedef itk::OtsuMultipleThresholdsCalculator > OtsuCalculatorType; > > ScalarImageToHistogramGeneratorType::Pointer > scalarImageToHistogramGenerator = > ScalarImageToHistogramGeneratorType::New(); > scalarImageToHistogramGenerator->SetNumberOfBins(128); > scalarImageToHistogramGenerator->SetInput(itkImage); > scalarImageToHistogramGenerator->Compute(); > > > OtsuCalculatorType::Pointer otsuCalculator = OtsuCalculatorType::New(); > otsuCalculator->SetNumberOfThresholds(numberOfThresholds); > > otsuCalculator->SetInputHistogram(scalarImageToHistogramGenerator->GetOutput()); > otsuCalculator->Update(); > > const OtsuCalculatorType::OutputType& thresholdVector = > otsuCalculator->GetOutput(); > HistogramType::MeasurementType threshold = > thresholdVector[usedThreshold]; > > > I tested this with itk configured with ITK_USE_REVIEW_STATISTICS set to ON > and once to OFF. > With some images, the results is not the same. > > Is this a known issue? > > thanks, > Zein > > _____________________________________ > 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 > _____________________________________ 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 From matt.mccormick at kitware.com Mon Apr 3 15:23:22 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Mon, 3 Apr 2017 15:23:22 -0400 Subject: [ITK] ItkVtkGlue In-Reply-To: <82fe70de-2b94-2ab4-c3b5-030a7d8f7e93@uclv.cu> References: <82fe70de-2b94-2ab4-c3b5-030a7d8f7e93@uclv.cu> Message-ID: Hi Manuel, Thanks for discussing the issue. I will see if I can reproduce the problem. Thanks, Matt On Tue, Mar 28, 2017 at 11:31 AM, Manuel Alejandro Castro Fuentes wrote: > Hello > > I'm building InsightToolkit-4.11.0 on Visual Studio 2015 with > ITK_WRAP_PYTHON=ON and Module_ITKVtkGlue=ON, for Python 3.5.3 and VTK 7.1.0. > The building process has no errors but when I try something like: > > filter = itk.ImageToVTKImageFilter[itk.Image[itk.UC, 3]].New() > > I got this error: > > Traceback (most recent call last): > File "", line 1, in > File "D:\Builds\ITK-4.11.0\Wrapping\Generators\Python\Release\itkLazy.py", > line 44, in __getattribute__ > itkBase.LoadModule(module, namespace) > File "D:\Builds\ITK-4.11.0\Wrapping\Generators\Python\Release\itkBase.py", > line 63, in LoadModule > swig.__dict__.update(this_module.swig.__dict__) > AttributeError: module 'ITKVtkGlue' has no attribute 'swig' > > Other modules work just fine as far as I have tried. I have done some things > with ITK+VTK+Python but using the Python(x,y) distribution, this is the > first time I'm building them from the source and wrapping them for Python. > If anyone can point me in the direction of a solution or an answer as to > what this may happen will be greatly appreciated. > > Thanks in advance > Manuel > _______________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community From matt.mccormick at kitware.com Mon Apr 3 17:00:31 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Mon, 3 Apr 2017 17:00:31 -0400 Subject: [ITK] On the deformable model In-Reply-To: References: Message-ID: Hi Nicol?s, > I think I haven't explained myself correctly. At the end of the presentation > there is a variational formulation of the problem, different to the one > shown at the Optical Flow section. In that one, the problem reads > > D[R,T;u] + a S[u], > > which you can derivate to get a nonlinear system of equations > > Au = f(u). > > This is an SSD metric with an elastic penalization (assuming S is such a > functional) and as far as I understand it should be the default metric as > stated in the software guide. This setting has no temporal evolution, and > can be solved by a fixed point iterative scheme as > > A u[k+1] = f(u[k]) > > or through a Newton-Raphson iterative scheme by looking for solutions of > > F(u) := Au - f(u) = 0, > > where you take a derivative and then iterate taking F(u[k+1]) = 0. Up to > this point, there is no time in any sense, which is confusing from the > example. When I read the code from DeformableRegistration1.h (the example I > mentioned before) and follow all the way what is happening, first the metric > is loaded > > https://github.com/InsightSoftwareConsortium/ITK/blob/aecfac233e8815cdd0121fd2351dd3fef80d2e1b/Modules/Registration/FEM/include/itkFEMRegistrationFilter.hxx#L536-L538 > > and then the solver is called to iterate > > https://github.com/InsightSoftwareConsortium/ITK/blob/aecfac233e8815cdd0121fd2351dd3fef80d2e1b/Modules/Registration/FEM/include/itkFEMRegistrationFilter.hxx#L547-L549. > > Now, if I go to check the kind of solver used, it is the CrankNicolson > Solver > > https://github.com/InsightSoftwareConsortium/ITK/blob/aecfac233e8815cdd0121fd2351dd3fef80d2e1b/Modules/Registration/FEM/include/itkFEMRegistrationFilter.h#L145 > > and checking the documentation for it says explicitly it is used for time > dependent problems > (https://itk.org/Doxygen/html/classitk_1_1fem_1_1SolverCrankNicolson.html), > which the mentioned formulation is not. While SolverCrankNicolson can be used for time dependent problems, in the context of the presentation (Au = f) and the example, https://github.com/InsightSoftwareConsortium/ITK/blob/f9110a0046a9d07a921767ba000443ad006a2c9b/Examples/RegistrationITKv4/DeformableRegistration1.cxx#L131 you are correct -- it is not being used for time-dependent problems, because they are only using a stiffness matrix and not a mass matrix. https://github.com/InsightSoftwareConsortium/ITK/blob/f9110a0046a9d07a921767ba000443ad006a2c9b/Modules/Numerics/FEM/include/itkFEMSolverCrankNicolson.hxx#L298-L318 > Now, in the variational Registration > filter > (https://itk.org/Doxygen/html/classitk_1_1VariationalRegistrationFilter.html), > [...] To clarify, there are five different registration frameworks within ITK. 1) The Variational Registration framework 2) The ITKv3 Registration framework 3) The ITKv4 Registration framework (classes have "v4" suffix). 4) The PDE deformable registration filters (these include optical flow algorithms) 5) The FEM Registration The VariationalRegistrationFilter is from the Variational Registration framework and is not used by FEM Registration. It sounds like you are most interested in variational registration, and the Variational Registration and ITKv4 Registration could help. More information can be found here: http://hdl.handle.net/10380/3460 https://itk.org/Doxygen/html/group__VariationalRegistration.html https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4009425/ https://itk.org/Doxygen/html/group__ITKMetricsv4.html https://itk.org/Doxygen/html/group__ITKRegistrationMethodsv4.html https://itk.org/Doxygen/html/group__ITKOptimizersv4.html I hope this helps. Matt From nabw91 at gmail.com Mon Apr 3 17:48:14 2017 From: nabw91 at gmail.com (=?UTF-8?Q?Nicol=C3=A1s_Barnafi?=) Date: Mon, 3 Apr 2017 18:48:14 -0300 Subject: [ITK] On the deformable model In-Reply-To: References: Message-ID: Hi Matt, That clarifies everything, thanks for the references and time. Best regards! On 3 April 2017 at 18:00, Matt McCormick wrote: > Hi Nicol?s, > > > > I think I haven't explained myself correctly. At the end of the > presentation > > there is a variational formulation of the problem, different to the one > > shown at the Optical Flow section. In that one, the problem reads > > > > D[R,T;u] + a S[u], > > > > which you can derivate to get a nonlinear system of equations > > > > Au = f(u). > > > > This is an SSD metric with an elastic penalization (assuming S is such a > > functional) and as far as I understand it should be the default metric as > > stated in the software guide. This setting has no temporal evolution, and > > can be solved by a fixed point iterative scheme as > > > > A u[k+1] = f(u[k]) > > > > or through a Newton-Raphson iterative scheme by looking for solutions of > > > > F(u) := Au - f(u) = 0, > > > > where you take a derivative and then iterate taking F(u[k+1]) = 0. Up to > > this point, there is no time in any sense, which is confusing from the > > example. When I read the code from DeformableRegistration1.h (the > example I > > mentioned before) and follow all the way what is happening, first the > metric > > is loaded > > > > https://github.com/InsightSoftwareConsortium/ITK/blob/ > aecfac233e8815cdd0121fd2351dd3fef80d2e1b/Modules/Registration/FEM/include/ > itkFEMRegistrationFilter.hxx#L536-L538 > > > > and then the solver is called to iterate > > > > https://github.com/InsightSoftwareConsortium/ITK/blob/ > aecfac233e8815cdd0121fd2351dd3fef80d2e1b/Modules/Registration/FEM/include/ > itkFEMRegistrationFilter.hxx#L547-L549. > > > > Now, if I go to check the kind of solver used, it is the CrankNicolson > > Solver > > > > https://github.com/InsightSoftwareConsortium/ITK/blob/ > aecfac233e8815cdd0121fd2351dd3fef80d2e1b/Modules/Registration/FEM/include/ > itkFEMRegistrationFilter.h#L145 > > > > and checking the documentation for it says explicitly it is used for time > > dependent problems > > (https://itk.org/Doxygen/html/classitk_1_1fem_1_ > 1SolverCrankNicolson.html), > > which the mentioned formulation is not. > > While SolverCrankNicolson can be used for time dependent problems, in > the context of the presentation (Au = f) and the example, > > https://github.com/InsightSoftwareConsortium/ITK/blob/ > f9110a0046a9d07a921767ba000443ad006a2c9b/Examples/RegistrationITKv4/ > DeformableRegistration1.cxx#L131 > > you are correct -- it is not being used for time-dependent problems, > because they are only using a stiffness matrix and not a mass matrix. > > https://github.com/InsightSoftwareConsortium/ITK/blob/ > f9110a0046a9d07a921767ba000443ad006a2c9b/Modules/Numerics/FEM/include/ > itkFEMSolverCrankNicolson.hxx#L298-L318 > > > > Now, in the variational Registration > > filter > > (https://itk.org/Doxygen/html/classitk_1_1VariationalRegistrationFilter > .html), > > [...] > > To clarify, there are five different registration frameworks within ITK. > > 1) The Variational Registration framework > > 2) The ITKv3 Registration framework > > 3) The ITKv4 Registration framework (classes have "v4" suffix). > > 4) The PDE deformable registration filters (these include optical flow > algorithms) > > 5) The FEM Registration > > The VariationalRegistrationFilter is from the Variational Registration > framework and is not used by FEM Registration. > > > It sounds like you are most interested in variational registration, > and the Variational Registration and ITKv4 Registration could help. > More information can be found here: > > http://hdl.handle.net/10380/3460 > https://itk.org/Doxygen/html/group__VariationalRegistration.html > > https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4009425/ > https://itk.org/Doxygen/html/group__ITKMetricsv4.html > https://itk.org/Doxygen/html/group__ITKRegistrationMethodsv4.html > https://itk.org/Doxygen/html/group__ITKOptimizersv4.html > > > I hope this helps. > > Matt > -- Nicol?s Alejandro Barnafi Wittwer -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.mccormick at kitware.com Mon Apr 3 18:52:02 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Mon, 3 Apr 2017 18:52:02 -0400 Subject: [ITK] Maintenance of the Insight Toolkit Message-ID: Hi folks, As United States government is re-examines the value of its funding initiatives, we have an opportunity to explain the value of the Insight Toolkit (ITK) project, and its associated open science community. The National Library of Medicine (NLM) has driven open science and reproducible research long before the recent surge in popularity of the movement. Not only did the NLM start the Insight Toolkit project in 1999, but it has continuously enabled it to thrive by supporting community development, maintenance, and algorithmic and technological advances to this day. Open science needs active communities, supported communities, standards, open-source tools, strong ties will commercial / clinical efforts, high-quality practices, transparency, and more - and those are exactly the strengths of our community's toolkits, applications, and projects. We should to encourage the NLM (NIH, DHHS, US Government) to continue to prioritize these efforts via their funding. To emphasize the impact of this community, please share your story. We would like to describe outstanding projects and efforts that use the Insight Toolkit. If you have stories, descriptions, or statistics of the impact of ITK or projects that leverage it, they justify future investments in this area. If you can help, please send a description of your project or your relationship with the Insight Toolkit for research, industry, or education to by Tuesday, April 11th. For example, Dear US National Library of Medicine, Thanks you for funding the Insight Toolkit project and supporting its maintenance and community. For the past two years, the documentation, software, and community have been a valuable resource for my research on neurocognitive imaging. Sincerely, Alice Insight, PhD Reproducible University Thank you, Matt From blowekamp at mail.nih.gov Wed Apr 5 08:57:15 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Wed, 5 Apr 2017 12:57:15 +0000 Subject: [ITK] [ITK-users] SimpleITK Serieswriter and DicomTags In-Reply-To: <89767550-AE53-4FCB-81F0-66A709E3253F@mail.nih.gov> References: <1490878156334-38050.post@n7.nabble.com> <031C16D1-4B43-4BD8-9C80-91A2F9C72B6B@mail.nih.gov> <54518069-C5F9-445E-983C-FDD5A2EDA798@mail.nih.gov> <89767550-AE53-4FCB-81F0-66A709E3253F@mail.nih.gov> Message-ID: Hello Matias, Ziv's patch was merged into SimpleITK?s master branch yesterday. The CDash builds[1] compiled the update and created binaries which are linked in the golden boxes. I believe you want CSharp for window 64[2]. Enjoy! Brad [1] https://open.cdash.org/index.php?project=SimpleITK [2] https://open.cdash.org/viewFiles.php?buildid=4839224 On Apr 2, 2017, at 9:58 AM, Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] > wrote: Hi Matias, We should get it into the main SimpleITK repository shortly (after testing etc..). For now please follow D?enan?s recommendation (clone my forked repository, checkout the dicomWrite branch and build SimpleITK from that branch). regards Ziv From: D?enan Zuki? > Date: Saturday, April 1, 2017 at 9:37 AM To: Matias > Cc: Insight-users > Subject: Re: [ITK-users] [ITK] SimpleITK Serieswriter and DicomTags Hi Matias, you should use branch dicomWrite from Ziv's fork. Regards, D?enan On Sat, Apr 1, 2017 at 2:48 AM, Matias > wrote: Thanks Yaniv. So how do I get this branch? I simply download the latest version of SimpleITK? El vie., 31 de mar. de 2017 a la(s) 19:18, Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] [via ITK - Users] <[hidden email]> escribi?: Hello Matias, Please take a look at the following github pull request (https://github.com/SimpleITK/SimpleITK/pull/134), this branch should provide the functionality you are looking for. See the Python example script included in the commit for the usage of the DICOM series writing. hope this helps Ziv From: Matias <[hidden email]> Date: Thursday, March 30, 2017 at 12:14 PM To: "[hidden email]" <[hidden email]> Subject: Re: [ITK-users] [ITK] SimpleITK Serieswriter and DicomTags Yes, this is what I would need to migrate to C#: It basically reads a dicom directory and performs rotation on the volume, then writes the resulting images back to a directory, copying the tags from the original images. #include "itkImage.h" #include "itkGDCMImageIO.h" #include "itkGDCMSeriesFileNames.h" #include "itkImageSeriesReader.h" #include "itkResampleImageFilter.h" #include "itkEuler3DTransform.hxx" #include "gdcmUIDGenerator.h" #include "itkImageFileWriter.h" #include "itkImageSeriesWriter.h" #include "itkNumericSeriesFileNames.h" #include "itkTranslationTransform.h" #include "string.h"; #include #include #include #include static void CopyDictionary(itk::MetaDataDictionary &fromDict, itk::MetaDataDictionary &toDict); int main(int argc, char* argv[]) { if (argc < 8) { std::cerr << "Uso: " << std::endl; std::cerr << argv[0] << " Directorio_A_Rotar DirectorioResultante Gamma Beta Alfa CentroRotacionX CentroRotacionY CentroRotacionZ" << std::endl; return EXIT_FAILURE; } typedef signed short PixelType; const unsigned int Dimension = 3; const unsigned int Dimension_Serie = 2; typedef itk::Image< PixelType, Dimension > ImageType; typedef itk::Image ImageType_Serie; typedef itk::ImageSeriesReader< ImageType > ReaderType; ReaderType::Pointer reader = ReaderType::New(); typedef itk::GDCMImageIO ImageIOType; ImageIOType::Pointer gdcmIO = ImageIOType::New(); reader->SetImageIO(gdcmIO); typedef itk::GDCMSeriesFileNames NamesGeneratorType; NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New(); nameGenerator->SetUseSeriesDetails(true); nameGenerator->AddSeriesRestriction("0008|0021"); nameGenerator->SetDirectory(argv[1]); try { std::cout << std::endl << "The directory: " << std::endl; std::cout << std::endl << argv[1] << std::endl << std::endl; std::cout << "Contains the following DICOM Series: "; std::cout << std::endl << std::endl; typedef std::vector< std::string > SeriesIdContainer; const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs(); SeriesIdContainer::const_iterator seriesItr = seriesUID.begin(); SeriesIdContainer::const_iterator seriesEnd = seriesUID.end(); while (seriesItr != seriesEnd) { std::cout << seriesItr->c_str() << std::endl; ++seriesItr; } std::string seriesIdentifier; seriesIdentifier = seriesUID.begin()->c_str(); std::cout << std::endl << std::endl; std::cout << "Now reading series: " << std::endl << std::endl; std::cout << seriesIdentifier << std::endl; std::cout << std::endl << std::endl; typedef std::vector< std::string > FileNamesContainer; FileNamesContainer fileNames; fileNames = nameGenerator->GetFileNames(seriesIdentifier); reader->SetFileNames(fileNames); try { reader->Update(); } catch (itk::ExceptionObject &ex) { std::cout << ex << std::endl; return EXIT_FAILURE; } const ImageType * inputImage = reader->GetOutput(); /*int numerodedicoms = inputImage->GetLargestPossibleRegion().GetSize()[2]; int dicomcentral = numerodedicoms / 2; std::cout << "Dimenion " << dicomcentral << std::endl;*/ //itk::EncapsulateMetaData(dictionary, "0020|0032","-208\\-236\\66"); typedef itk::ResampleImageFilter FilterType; FilterType::Pointer FiltroResample = FilterType::New(); FiltroResample->SetInput(reader->GetOutput()); typedef itk::LinearInterpolateImageFunction InterpolatorType; InterpolatorType::Pointer interpolator = InterpolatorType::New(); FiltroResample->SetInterpolator(interpolator); FiltroResample->SetOutputDirection(inputImage->GetDirection()); FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); ImageType::SizeType inputSize = inputImage->GetLargestPossibleRegion().GetSize(); FiltroResample->SetSize(inputSize); const ImageType::SpacingType& inputSpacing = inputImage->GetSpacing(); FiltroResample->SetOutputSpacing(inputSpacing); FiltroResample->SetDefaultPixelValue(-1000); //Cambiar por un parametro typedef itk::Euler3DTransform< double > TransformType; //Transform TransformType::Pointer transform = TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z; gamma = atof(argv[3]); beta= atof(argv[4]); alfa = atof(argv[5]); centro_rotacion_X = atof(argv[6]); centro_rotacion_Y = atof(argv[7]); centro_rotacion_Z = atof(argv[8]); transform->SetRotation(gamma, beta, alfa); //Radianes en el siguiente orden en ITK: Gamma, Beta, Alfa | Ibarra //double centro[3] = { -14.8371, -54.9443, 175.75 }; //XmmPromedio, YmmPromedio, Z Central (mm): Leer directorio y tomar la del medio double centro[3] = { centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z }; //XmmPromedio, YmmPromedio, Z Central (mm): Leer directorio y tomar la del medio transform->SetCenter(centro); std::cout << "Centro: " << std::endl << std::endl; std::cout << transform->GetCenter() << std::endl; FiltroResample->SetTransform(transform); //FiltroResample->SetMetaDataDictionary(dictionary); try { FiltroResample->Update(); } catch (itk::ExceptionObject &ex) { return EXIT_FAILURE; } ReaderType::DictionaryRawPointer inputDict = (*(reader->GetMetaDataDictionaryArray()))[0]; ReaderType::DictionaryArrayType outputArray; //std::cout << "array: " << std::endl << outputArray[0] << std::endl; // To keep the new series in the same study as the original we need // to keep the same study UID. But we need new series and frame of // reference UID's. gdcm::UIDGenerator suid; //std::string seriesUID = suid.Generate(); gdcm::UIDGenerator fuid; std::string frameOfReferenceUID = fuid.Generate(); std::string studyUID; std::string sopClassUID; itk::ExposeMetaData(*inputDict, "0020|000d", studyUID); itk::ExposeMetaData(*inputDict, "0008|0016", sopClassUID); gdcmIO->KeepOriginalUIDOn(); using namespace std; double myArray_Z[70]; //Cambiar esto por un argumento que especifica la cantidad de imagenes. double myArray_X[70]; //Cambiar esto por un argumento que especifica la cantidad de imagenes. double myArray_Y[70]; //Cambiar esto por un argumento que especifica la cantidad de imagenes. ifstream file("file.txt"); if (file.is_open()) { for (int i = 0; i < 70; ++i) //Recordar cambiar por el argumento que especifica cantidad de imagenes { file >> myArray_Z[i]; } } std::cout << "valor primer Z array: " << std::endl << std::endl; std::cout << myArray_Z[0] << std::endl; for (unsigned int f = 0; f < inputSize[2]; f++) { // Create a new dictionary for this slice ReaderType::DictionaryRawPointer dict = new ReaderType::DictionaryType; // Copy the dictionary from the first slice CopyDictionary(*inputDict, *dict); // Set the UID's for the study, series, SOP and frame of reference itk::EncapsulateMetaData(*dict, "0020|000d", studyUID); //itk::EncapsulateMetaData(*dict, "0020|000e", seriesUID); itk::EncapsulateMetaData(*dict, "0020|0052", frameOfReferenceUID); gdcm::UIDGenerator sopuid; std::string sopInstanceUID = sopuid.Generate(); itk::EncapsulateMetaData(*dict, "0008|0018", sopInstanceUID); itk::EncapsulateMetaData(*dict, "0002|0003", sopInstanceUID); // Change fields that are slice specific std::ostringstream value; value.str(""); value << f + 1; // Image Number itk::EncapsulateMetaData(*dict, "0020|0013", value.str()); // Series Description - Append new description to current series // description std::string oldSeriesDesc; itk::ExposeMetaData(*inputDict, "0008|103e", oldSeriesDesc); value.str(""); value << oldSeriesDesc << ": Resampled with pixel spacing " << inputSpacing[0] << ", " << inputSpacing[1] << ", " << inputSpacing[2]; // This is an long string and there is a 64 character limit in the // standard unsigned lengthDesc = value.str().length(); std::string seriesDesc(value.str(), 0, lengthDesc > 64 ? 64 : lengthDesc); itk::EncapsulateMetaData(*dict, "0008|103e", seriesDesc); // Series Number value.str(""); value << 1001; itk::EncapsulateMetaData(*dict, "0020|0011", value.str()); // Derivation Description - How this image was derived value.str(""); for (int i = 0; i < argc; i++) { value << argv[i] << " "; } lengthDesc = value.str().length(); std::string derivationDesc(value.str(), 0, lengthDesc > 1024 ? 1024 : lengthDesc); itk::EncapsulateMetaData(*dict, "0008|2111", derivationDesc); // Image Position Patient: This is calculated by computing the // physical coordinate of the first pixel in each slice. ImageType::PointType position; ImageType::IndexType index; index[0] = 0; index[1] = 0; index[2] = myArray_Z[f]; FiltroResample->GetOutput()->TransformIndexToPhysicalPoint(index, position); //El origen que calculamos en el proyecto no se toca. (Origen = origen - average) //Cambiamos el ImageOrientationPatient SOLAMENTE si el valor original en la imagen es: 1\0\0\0\1\0. En el caso que se cambia el signo, se debe cambiar el signo del origen //value.str(""); //value << -1 << "\\" << 0 << "\\" << 0 << "\\" << 0 << "\\" << -1 << "\\" << 0; //PASAR ESTO POR ARGUMENTO!!! //itk::EncapsulateMetaData(*dict, "0020|0037", value.str()); value.str(""); value << -235.1629 << "\\" << -195.0557 << "\\" << myArray_Z[f]; //PASAR ESTO POR ARGUMENTO!!! El origen - Centro itk::EncapsulateMetaData(*dict, "0020|0032", value.str()); // Slice Location: For now, we store the z component of the Image // Position Patient. value.str(""); value << position[2]; itk::EncapsulateMetaData(*dict, "0020|1041", value.str()); // Slice Thickness: For now, we store the z spacing value.str(""); value << inputSpacing[2]; itk::EncapsulateMetaData(*dict, "0018|0050", value.str()); // Spacing Between Slices itk::EncapsulateMetaData(*dict, "0018|0088", value.str()); // Save the dictionary outputArray.push_back(dict); } typedef itk::ImageFileWriter< ImageType > WriterType; WriterType::Pointer writer = WriterType::New(); typedef itk::ImageSeriesWriter< ImageType, ImageType_Serie > SeriesWriterType; SeriesWriterType::Pointer seriesWriter = SeriesWriterType::New(); seriesWriter->SetInput(FiltroResample->GetOutput()); writer->SetFileName(argv[2]); writer->SetInput(FiltroResample->GetOutput()); itksys::SystemTools::MakeDirectory("Test"); //PASAR ESTO POR ARGUMENTO!! typedef itk::NumericSeriesFileNames OutputNamesGeneratorType; OutputNamesGeneratorType::Pointer outputNames = OutputNamesGeneratorType::New(); std::string seriesFormat("Test"); //PASAR ESTO POR ARGUMENTO!! seriesFormat = seriesFormat + "/" + "IM%d.dcm"; outputNames->SetSeriesFormat(seriesFormat.c_str()); outputNames->SetStartIndex(1); outputNames->SetEndIndex(inputSize[2]); seriesWriter->SetImageIO(gdcmIO); seriesWriter->SetFileNames(outputNames->GetFileNames()); seriesWriter->SetMetaDataDictionaryArray(&outputArray); std::cout << "Escribiendo la imagen como..." << std::endl << std::endl; std::cout << argv[2] << std::endl << std::endl; try { writer->Update(); seriesWriter->Update(); } catch (itk::ExceptionObject &ex) { std::cout << ex << std::endl; return EXIT_FAILURE; } } catch (itk::ExceptionObject &ex) { std::cout << ex << std::endl; return EXIT_FAILURE; } return EXIT_SUCCESS; } void CopyDictionary(itk::MetaDataDictionary &fromDict, itk::MetaDataDictionary &toDict) { typedef itk::MetaDataDictionary DictionaryType; DictionaryType::ConstIterator itr = fromDict.Begin(); DictionaryType::ConstIterator end = fromDict.End(); typedef itk::MetaDataObject< std::string > MetaDataStringType; while (itr != end) { itk::MetaDataObjectBase::Pointer entry = itr->second; MetaDataStringType::Pointer entryvalue = dynamic_cast(entry.GetPointer()); if (entryvalue) { std::string tagkey = itr->first; std::string tagvalue = entryvalue->GetMetaDataObjectValue(); itk::EncapsulateMetaData(toDict, tagkey, tagvalue); } ++itr; } } El jue., 30 de mar. de 2017 a la(s) 11:25, Lowekamp, Bradley (NIH/NLM/LHC) [C] [via ITK - Users] <[hidden email]> escribi?: Hello, Writing correct DICOM continues to be a struggle with SimpleITK and ITK. It is generally recommended to directly use GDCM or DCMTK to write a proper DICOM series. SimpleITK tries to keep things, well, simple and straight forward. But ITK ties to do some smart things, which get in the way for certain uses with SimpleITK. We are trying to document and develop a nominal set of DICOM output operations that work in SimpleITK. Do you have working C++ code that works for your intended operation? Can you share a small section of code which does what you expect it C++? Thank, Brad > On Mar 30, 2017, at 8:49 AM, Matias <[hidden email]> wrote: > > Hi, > > I've been dealing with ITK for years in C++ and now I would need to use > SimpleITK and C# as far as I can in a new proyect. > > Is the SimpleITK SeriesWriter working for Dicom Files? Last time I tried to > use it I had problems with the DicomTags, these would not copy or there was > no method to copy the tags to the resulting slices. > > Currently, I read a volume of slices, apply rotation and then I need to > write the resulting image as another set of slices AND keeping tag > information such as patient name, etc. > > Thank you, > > Matias. > > > > -- > View this message in context: http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050.html > Sent from the ITK - 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 > _______________________________________________ > Community mailing list > [hidden email] > http://public.kitware.com/mailman/listinfo/community _____________________________________ 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 ________________________________ If you reply to this email, your message will be added to the discussion below: http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050p38052.html To unsubscribe from SimpleITK Serieswriter and DicomTags, click here. NAML -- Matias ________________________________ View this message in context: Re: [ITK-users] [ITK] SimpleITK Serieswriter and DicomTags Sent from the ITK - 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 If you reply to this email, your message will be added to the discussion below: http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050p38063.html To unsubscribe from SimpleITK Serieswriter and DicomTags, click here. NAML -- Matias ________________________________ View this message in context: Re: [ITK-users] [ITK] SimpleITK Serieswriter and DicomTags Sent from the ITK - 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 _____________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matimontg at gmail.com Wed Apr 5 09:22:09 2017 From: matimontg at gmail.com (Matias) Date: Wed, 5 Apr 2017 06:22:09 -0700 (MST) Subject: [ITK] [ITK-users] SimpleITK Serieswriter and DicomTags In-Reply-To: References: <1490878156334-38050.post@n7.nabble.com> <031C16D1-4B43-4BD8-9C80-91A2F9C72B6B@mail.nih.gov> <54518069-C5F9-445E-983C-FDD5A2EDA798@mail.nih.gov> <89767550-AE53-4FCB-81F0-66A709E3253F@mail.nih.gov> Message-ID: Awesome, thanks! El mi?., 5 de abr. de 2017 a la(s) 09:57, Lowekamp, Bradley (NIH/NLM/LHC) [C] [via ITK - Users] escribi?: > Hello Matias, > > Ziv's patch was merged into SimpleITK?s master branch yesterday. The CDash > builds[1] compiled the update and created binaries which are linked in the > golden boxes. I believe you want CSharp for window 64[2]. > > Enjoy! > Brad > > [1] https://open.cdash.org/index.php?project=SimpleITK > [2] https://open.cdash.org/viewFiles.php?buildid=4839224 > > On Apr 2, 2017, at 9:58 AM, Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] <[hidden > email] > wrote: > > Hi Matias, > > We should get it into the main SimpleITK repository shortly (after testing > etc..). For now please follow D?enan?s recommendation (clone my forked > repository, checkout the dicomWrite branch and build SimpleITK from that > branch). > > regards > Ziv > > > *From: *D?enan Zuki? <[hidden email] > > > *Date: *Saturday, April 1, 2017 at 9:37 AM > *To: *Matias <[hidden email] > > > *Cc: *Insight-users <[hidden email] > > > > > *Subject: *Re: [ITK-users] [ITK] SimpleITK Serieswriter and DicomTags > > Hi Matias, > > you should use branch dicomWrite from Ziv's fork > . > > Regards, > D?enan > > > On Sat, Apr 1, 2017 at 2:48 AM, Matias <[hidden email] > > wrote: > > Thanks Yaniv. So how do I get this branch? I simply download the latest > version of SimpleITK? > El vie., 31 de mar. de 2017 a la(s) 19:18, Yaniv, Ziv Rafael (NIH/NLM/LHC) > [C] [via ITK - Users] <[hidden email] > > escribi?: > > Hello Matias, > > Please take a look at the following github pull request ( > https://github.com/SimpleITK/SimpleITK/pull/134), this branch should > provide the functionality you are looking for. See the Python example > script included in the commit for the usage of the DICOM series writing. > > hope this helps > Ziv > > > *From: *Matias <[hidden email] > > > > *Date: *Thursday, March 30, 2017 at 12:14 PM > *To: *"[hidden email] " > <[hidden email] > > > *Subject: *Re: [ITK-users] [ITK] SimpleITK Serieswriter and DicomTags > > Yes, this is what I would need to migrate to C#: > It basically reads a dicom directory and performs rotation on the volume, > then writes the resulting images back to a directory, copying the tags from > the original images. > > #include "itkImage.h" > #include "itkGDCMImageIO.h" > #include "itkGDCMSeriesFileNames.h" > #include "itkImageSeriesReader.h" > #include "itkResampleImageFilter.h" > #include "itkEuler3DTransform.hxx" > #include "gdcmUIDGenerator.h" > > #include "itkImageFileWriter.h" > #include "itkImageSeriesWriter.h" > #include "itkNumericSeriesFileNames.h" > #include "itkTranslationTransform.h" > #include "string.h"; > #include > > #include > #include > #include > > > > static void CopyDictionary(itk::MetaDataDictionary &fromDict, > itk::MetaDataDictionary &toDict); > > int main(int argc, char* argv[]) > { > if (argc < 8) > { > std::cerr << "Uso: " << std::endl; > std::cerr << argv[0] << " Directorio_A_Rotar DirectorioResultante Gamma > Beta Alfa CentroRotacionX CentroRotacionY CentroRotacionZ" > << std::endl; > return EXIT_FAILURE; > } > > typedef signed short PixelType; > const unsigned int Dimension = 3; > const unsigned int Dimension_Serie = 2; > typedef itk::Image< PixelType, Dimension > ImageType; > typedef itk::Image ImageType_Serie; > > typedef itk::ImageSeriesReader< ImageType > ReaderType; > ReaderType::Pointer reader = ReaderType::New(); > > typedef itk::GDCMImageIO ImageIOType; > ImageIOType::Pointer gdcmIO = ImageIOType::New(); > reader->SetImageIO(gdcmIO); > > typedef itk::GDCMSeriesFileNames NamesGeneratorType; > NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New(); > nameGenerator->SetUseSeriesDetails(true); > nameGenerator->AddSeriesRestriction("0008|0021"); > nameGenerator->SetDirectory(argv[1]); > > try > { > std::cout << std::endl << "The directory: " << std::endl; > std::cout << std::endl << argv[1] << std::endl << std::endl; > std::cout << "Contains the following DICOM Series: "; > std::cout << std::endl << std::endl; > > typedef std::vector< std::string > SeriesIdContainer; > const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs(); > SeriesIdContainer::const_iterator seriesItr = seriesUID.begin(); > SeriesIdContainer::const_iterator seriesEnd = seriesUID.end(); > while (seriesItr != seriesEnd) > { > std::cout << seriesItr->c_str() << std::endl; > ++seriesItr; > } > > std::string seriesIdentifier; > > seriesIdentifier = seriesUID.begin()->c_str(); > > > std::cout << std::endl << std::endl; > std::cout << "Now reading series: " << std::endl << std::endl; > std::cout << seriesIdentifier << std::endl; > std::cout << std::endl << std::endl; > > typedef std::vector< std::string > FileNamesContainer; > FileNamesContainer fileNames; > fileNames = nameGenerator->GetFileNames(seriesIdentifier); > > reader->SetFileNames(fileNames); > > try > { > reader->Update(); > } > catch (itk::ExceptionObject &ex) > { > std::cout << ex << std::endl; > return EXIT_FAILURE; > } > > const ImageType * inputImage = reader->GetOutput(); > /*int numerodedicoms = inputImage->GetLargestPossibleRegion().GetSize()[2]; > int dicomcentral = numerodedicoms / 2; > std::cout << "Dimenion " << dicomcentral << std::endl;*/ > //itk::EncapsulateMetaData(dictionary, > "0020|0032","-208\\-236\\66"); > > typedef itk::ResampleImageFilter FilterType; > FilterType::Pointer FiltroResample = FilterType::New(); > FiltroResample->SetInput(reader->GetOutput()); > > typedef itk::LinearInterpolateImageFunction > InterpolatorType; > InterpolatorType::Pointer interpolator = InterpolatorType::New(); > FiltroResample->SetInterpolator(interpolator); > FiltroResample->SetOutputDirection(inputImage->GetDirection()); > FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); > > ImageType::SizeType inputSize = > inputImage->GetLargestPossibleRegion().GetSize(); > FiltroResample->SetSize(inputSize); > > const ImageType::SpacingType& inputSpacing = inputImage->GetSpacing(); > FiltroResample->SetOutputSpacing(inputSpacing); > > FiltroResample->SetDefaultPixelValue(-1000); //Cambiar por un parametro > > typedef itk::Euler3DTransform< double > TransformType; //Transform > TransformType::Pointer transform = TransformType::New(); > double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, > centro_rotacion_Z; > gamma = atof(argv[3]); > beta= atof(argv[4]); > alfa = atof(argv[5]); > centro_rotacion_X = atof(argv[6]); > centro_rotacion_Y = atof(argv[7]); > centro_rotacion_Z = atof(argv[8]); > transform->SetRotation(gamma, beta, alfa); //Radianes en el siguiente > orden en ITK: Gamma, Beta, Alfa | Ibarra > //double centro[3] = { -14.8371, -54.9443, 175.75 }; //XmmPromedio, > YmmPromedio, Z Central (mm): Leer directorio y tomar la del medio > double centro[3] = { centro_rotacion_X, centro_rotacion_Y, > centro_rotacion_Z }; //XmmPromedio, YmmPromedio, Z Central (mm): Leer > directorio y tomar la del medio > transform->SetCenter(centro); > std::cout << "Centro: " << std::endl << std::endl; > std::cout << transform->GetCenter() << std::endl; > > FiltroResample->SetTransform(transform); > //FiltroResample->SetMetaDataDictionary(dictionary); > try > { > FiltroResample->Update(); > } > catch (itk::ExceptionObject &ex) > { > return EXIT_FAILURE; > } > > > > ReaderType::DictionaryRawPointer inputDict = > (*(reader->GetMetaDataDictionaryArray()))[0]; > ReaderType::DictionaryArrayType outputArray; > //std::cout << "array: " << std::endl << outputArray[0] << std::endl; > // To keep the new series in the same study as the original we need > // to keep the same study UID. But we need new series and frame of > // reference UID's. > gdcm::UIDGenerator suid; > //std::string seriesUID = suid.Generate(); > gdcm::UIDGenerator fuid; > std::string frameOfReferenceUID = fuid.Generate(); > > std::string studyUID; > std::string sopClassUID; > itk::ExposeMetaData(*inputDict, "0020|000d", studyUID); > itk::ExposeMetaData(*inputDict, "0008|0016", sopClassUID); > gdcmIO->KeepOriginalUIDOn(); > > using namespace std; > double myArray_Z[70]; //Cambiar esto por un argumento que especifica la > cantidad de imagenes. > double myArray_X[70]; //Cambiar esto por un argumento que especifica la > cantidad de imagenes. > double myArray_Y[70]; //Cambiar esto por un argumento que especifica la > cantidad de imagenes. > > ifstream file("file.txt"); > if (file.is_open()) > { > for (int i = 0; i < 70; ++i) //Recordar cambiar por el argumento que > especifica cantidad de imagenes > { > file >> myArray_Z[i]; > } > } > std::cout << "valor primer Z array: " << std::endl << std::endl; > std::cout << myArray_Z[0] << std::endl; > > for (unsigned int f = 0; f < inputSize[2]; f++) > { > // Create a new dictionary for this slice > ReaderType::DictionaryRawPointer dict = new ReaderType::DictionaryType; > > // Copy the dictionary from the first slice > CopyDictionary(*inputDict, *dict); > > // Set the UID's for the study, series, SOP and frame of reference > itk::EncapsulateMetaData(*dict, "0020|000d", studyUID); > //itk::EncapsulateMetaData(*dict, "0020|000e", seriesUID); > itk::EncapsulateMetaData(*dict, "0020|0052", > frameOfReferenceUID); > > gdcm::UIDGenerator sopuid; > std::string sopInstanceUID = sopuid.Generate(); > > itk::EncapsulateMetaData(*dict, "0008|0018", sopInstanceUID); > itk::EncapsulateMetaData(*dict, "0002|0003", sopInstanceUID); > > // Change fields that are slice specific > std::ostringstream value; > value.str(""); > value << f + 1; > > // Image Number > itk::EncapsulateMetaData(*dict, "0020|0013", value.str()); > > // Series Description - Append new description to current series > // description > std::string oldSeriesDesc; > itk::ExposeMetaData(*inputDict, "0008|103e", oldSeriesDesc); > > value.str(""); > value << oldSeriesDesc > << ": Resampled with pixel spacing " > << inputSpacing[0] << ", " > << inputSpacing[1] << ", " > << inputSpacing[2]; > // This is an long string and there is a 64 character limit in the > // standard > unsigned lengthDesc = value.str().length(); > > std::string seriesDesc(value.str(), 0, > lengthDesc > 64 ? 64 > : lengthDesc); > itk::EncapsulateMetaData(*dict, "0008|103e", seriesDesc); > > // Series Number > value.str(""); > value << 1001; > itk::EncapsulateMetaData(*dict, "0020|0011", value.str()); > > // Derivation Description - How this image was derived > value.str(""); > for (int i = 0; i < argc; i++) > { > value << argv[i] << " "; > } > > lengthDesc = value.str().length(); > std::string derivationDesc(value.str(), 0, > lengthDesc > 1024 ? 1024 > : lengthDesc); > itk::EncapsulateMetaData(*dict, "0008|2111", derivationDesc); > > // Image Position Patient: This is calculated by computing the > // physical coordinate of the first pixel in each slice. > ImageType::PointType position; > ImageType::IndexType index; > index[0] = 0; > index[1] = 0; > index[2] = myArray_Z[f]; > FiltroResample->GetOutput()->TransformIndexToPhysicalPoint(index, > position); > > //El origen que calculamos en el proyecto no se toca. (Origen = origen - > average) > > //Cambiamos el ImageOrientationPatient SOLAMENTE si el valor original en > la imagen es: 1\0\0\0\1\0. En el caso que se cambia el signo, se debe > cambiar el signo del origen > //value.str(""); > //value << -1 << "\\" << 0 << "\\" << 0 << "\\" << 0 << "\\" << -1 << "\\" > << 0; //PASAR ESTO POR ARGUMENTO!!! > //itk::EncapsulateMetaData(*dict, "0020|0037", value.str()); > > value.str(""); > value << -235.1629 << "\\" << -195.0557 << "\\" << myArray_Z[f]; //PASAR > ESTO POR ARGUMENTO!!! El origen - Centro > itk::EncapsulateMetaData(*dict, "0020|0032", value.str()); > > > // Slice Location: For now, we store the z component of the Image > // Position Patient. > value.str(""); > value << position[2]; > itk::EncapsulateMetaData(*dict, "0020|1041", value.str()); > > // Slice Thickness: For now, we store the z spacing > value.str(""); > value << inputSpacing[2]; > itk::EncapsulateMetaData(*dict, "0018|0050", > value.str()); > // Spacing Between Slices > itk::EncapsulateMetaData(*dict, "0018|0088", > value.str()); > > // Save the dictionary > outputArray.push_back(dict); > } > > > typedef itk::ImageFileWriter< ImageType > WriterType; > WriterType::Pointer writer = WriterType::New(); > > typedef itk::ImageSeriesWriter< ImageType, ImageType_Serie > > SeriesWriterType; > SeriesWriterType::Pointer seriesWriter = SeriesWriterType::New(); > seriesWriter->SetInput(FiltroResample->GetOutput()); > > writer->SetFileName(argv[2]); > writer->SetInput(FiltroResample->GetOutput()); > > itksys::SystemTools::MakeDirectory("Test"); //PASAR ESTO POR ARGUMENTO!! > typedef itk::NumericSeriesFileNames OutputNamesGeneratorType; > OutputNamesGeneratorType::Pointer outputNames = > OutputNamesGeneratorType::New(); > std::string seriesFormat("Test"); //PASAR ESTO POR ARGUMENTO!! > seriesFormat = seriesFormat + "/" + "IM%d.dcm"; > outputNames->SetSeriesFormat(seriesFormat.c_str()); > outputNames->SetStartIndex(1); > outputNames->SetEndIndex(inputSize[2]); > > seriesWriter->SetImageIO(gdcmIO); > seriesWriter->SetFileNames(outputNames->GetFileNames()); > seriesWriter->SetMetaDataDictionaryArray(&outputArray); > > std::cout << "Escribiendo la imagen como..." << std::endl << std::endl; > std::cout << argv[2] << std::endl << std::endl; > > try > { > writer->Update(); > seriesWriter->Update(); > } > catch (itk::ExceptionObject &ex) > { > std::cout << ex << std::endl; > return EXIT_FAILURE; > } > > > } > catch (itk::ExceptionObject &ex) > { > std::cout << ex << std::endl; > return EXIT_FAILURE; > } > > return EXIT_SUCCESS; > > } > > void CopyDictionary(itk::MetaDataDictionary &fromDict, > itk::MetaDataDictionary &toDict) > { > typedef itk::MetaDataDictionary DictionaryType; > > DictionaryType::ConstIterator itr = fromDict.Begin(); > DictionaryType::ConstIterator end = fromDict.End(); > typedef itk::MetaDataObject< std::string > MetaDataStringType; > > while (itr != end) > { > itk::MetaDataObjectBase::Pointer entry = itr->second; > > MetaDataStringType::Pointer entryvalue = > dynamic_cast(entry.GetPointer()); > if (entryvalue) > { > std::string tagkey = itr->first; > std::string tagvalue = entryvalue->GetMetaDataObjectValue(); > itk::EncapsulateMetaData(toDict, tagkey, tagvalue); > } > ++itr; > } > } > > > El jue., 30 de mar. de 2017 a la(s) 11:25, Lowekamp, Bradley (NIH/NLM/LHC) > [C] [via ITK - Users] <[hidden email]> escribi?: > > Hello, > > Writing correct DICOM continues to be a struggle with SimpleITK and ITK. > It is generally recommended to directly use GDCM or DCMTK to write a proper > DICOM series. > > SimpleITK tries to keep things, well, simple and straight forward. But ITK > ties to do some smart things, which get in the way for certain uses with > SimpleITK. We are trying to document and develop a nominal set of DICOM > output operations that work in SimpleITK. > > Do you have working C++ code that works for your intended operation? Can > you share a small section of code which does what you expect it C++? > > Thank, > Brad > > > > On Mar 30, 2017, at 8:49 AM, Matias <[hidden email] > > wrote: > > > > Hi, > > > > I've been dealing with ITK for years in C++ and now I would need to use > > SimpleITK and C# as far as I can in a new proyect. > > > > Is the SimpleITK SeriesWriter working for Dicom Files? Last time I tried > to > > use it I had problems with the DicomTags, these would not copy or there > was > > no method to copy the tags to the resulting slices. > > > > Currently, I read a volume of slices, apply rotation and then I need to > > write the resulting image as another set of slices AND keeping tag > > information such as patient name, etc. > > > > Thank you, > > > > Matias. > > > > > > > > -- > > View this message in context: > http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050.html > > Sent from the ITK - 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 > > _______________________________________________ > > Community mailing list > > [hidden email] > > http://public.kitware.com/mailman/listinfo/community > > > _____________________________________ > 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 > ------------------------------ > *If you reply to this email, your message will be added to the discussion > below:* > > http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050p38052.html > To unsubscribe from SimpleITK Serieswriter and DicomTags, click here. > NAML > > > -- > Matias > > ------------------------------ > View this message in context: Re: [ITK-users] [ITK] SimpleITK > Serieswriter and DicomTags > > > > Sent from the ITK - 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 > > *If you reply to this email, your message will be added to the discussion > below:* > > http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050p38063.html > To unsubscribe from SimpleITK Serieswriter and DicomTags, click here. > NAML > > > -- > Matias > > ------------------------------ > View this message in context: Re: [ITK-users] [ITK] SimpleITK > Serieswriter and DicomTags > > Sent from the ITK - Users mailing list archive > at > > -- Matias -- View this message in context: http://itk-users.7.n7.nabble.com/SimpleITK-Serieswriter-and-DicomTags-tp38050p38073.html Sent from the ITK - Users mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matt.mccormick at kitware.com Wed Apr 5 15:57:45 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Wed, 5 Apr 2017 15:57:45 -0400 Subject: [ITK] ItkVtkGlue In-Reply-To: References: <82fe70de-2b94-2ab4-c3b5-030a7d8f7e93@uclv.cu> Message-ID: Hi Manuel, I was able to create an import error, and then it was resolved by adding the directory with the file vtkImagingCorePython35D-7.1.dll to the PATH environmental variable. Hope this helps, Matt On Mon, Apr 3, 2017 at 3:23 PM, Matt McCormick wrote: > Hi Manuel, > > Thanks for discussing the issue. > > I will see if I can reproduce the problem. > > Thanks, > Matt > > On Tue, Mar 28, 2017 at 11:31 AM, Manuel Alejandro Castro Fuentes > wrote: >> Hello >> >> I'm building InsightToolkit-4.11.0 on Visual Studio 2015 with >> ITK_WRAP_PYTHON=ON and Module_ITKVtkGlue=ON, for Python 3.5.3 and VTK 7.1.0. >> The building process has no errors but when I try something like: >> >> filter = itk.ImageToVTKImageFilter[itk.Image[itk.UC, 3]].New() >> >> I got this error: >> >> Traceback (most recent call last): >> File "", line 1, in >> File "D:\Builds\ITK-4.11.0\Wrapping\Generators\Python\Release\itkLazy.py", >> line 44, in __getattribute__ >> itkBase.LoadModule(module, namespace) >> File "D:\Builds\ITK-4.11.0\Wrapping\Generators\Python\Release\itkBase.py", >> line 63, in LoadModule >> swig.__dict__.update(this_module.swig.__dict__) >> AttributeError: module 'ITKVtkGlue' has no attribute 'swig' >> >> Other modules work just fine as far as I have tried. I have done some things >> with ITK+VTK+Python but using the Python(x,y) distribution, this is the >> first time I'm building them from the source and wrapping them for Python. >> If anyone can point me in the direction of a solution or an answer as to >> what this may happen will be greatly appreciated. >> >> Thanks in advance >> Manuel >> _______________________________________________ >> Community mailing list >> Community at itk.org >> http://public.kitware.com/mailman/listinfo/community From jonathan.lefman at intel.com Wed Apr 5 16:57:57 2017 From: jonathan.lefman at intel.com (Lefman, Jonathan) Date: Wed, 5 Apr 2017 20:57:57 +0000 Subject: [ITK] [ITK-dev] Build errors using a different C and CXX compiler Message-ID: Hi all, I am attempting to build ITK from source (have tried using v4.11.0 and master) using a different CXX compiler. To start, I do not have an issue when I utilize the default compiler (gcc) as much compiler. This works fine; tests are successful. The error I encounter on both Ubuntu and Centos systems is the same. It looks like this on the make output: [ 58%] Building CXX object Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver.dir/itkRayCastInterpolateImageFunctionTest.cxx.o /src/ITK/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx(38): error: member "::RayCastHelper::InputImageDimension [with TInputImage=itk::Image, TCoordRep=double]" was referenced but not defined itkStaticConstMacro(InputImageDimension, unsigned int, ^ compilation aborted for /src/ITK/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFunctionTest.cxx (code 2) make[2]: *** [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver.dir/itkRayCastInterpolateImageFunctionTest.cxx.o] Error 2 make[1]: *** [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver.dir/all] Error 2 make: *** [all] Error 2 My cmake setup looks like this: CC=/intel/bin/icc CXX=/intel/bin/icc cmake -DCMAKE_CXX_COMPILER:FILEPATH=$CXX -DCMAKE_C_COMPILER:FILEPATH=$CC -DModule_PerformanceBenchmarking:BOOL=ON .. Example generated CXX_FLAGS are from: ./Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver.dir/flags.make # compile CXX with /intel/bin/icc CXX_FLAGS = -w2 -wd1268 -wd981 -wd383 -wd1418 -wd1419 -wd2259 -wd1572 -wd424 -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -Wno-deprecated -Wno-invalid-offsetof -Woverloaded-virtual -O3 -DNDEBUG -fPIE -I/src/ITK/Modules/Core/ImageAdaptors/include -I/src/ITK/build_icc/Modules/ThirdParty/KWIML/src -I/src/ITK/Modules/ThirdParty/KWIML/src -I/src/ITK/build_icc/Modules/ThirdParty/KWSys/src -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/v3p/netlib -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/vcl -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/v3p/netlib -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/vcl -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/core -I/src/ITK/Modules/ThirdParty/VNLInstantiation/include -I/src/ITK/build_icc/Modules/Core/Common -I/src/ITK/Modules/Core/Common/include -I/src/ITK/build_icc/Modules/ThirdParty/Netlib -I/src/ITK/Modules/Numerics/Statistics/include -I/src/ITK/Modules/Filtering/ImageFilterBase/include -I/src/ITK/Modules/Core/Transform/include -I/src/ITK/Modules/Core/ImageFunction/include -I/src/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion -I/src/ITK/build_icc/Modules/ThirdParty/DoubleConversion/src/double-conversion -I/src/ITK/Modules/IO/BMP/include -I/src/ITK/build_icc/Modules/ThirdParty/Expat/src/expat -I/src/ITK/Modules/ThirdParty/Expat/src/expat -I/src/ITK/build_icc/Modules/ThirdParty/ZLIB/src -I/src/ITK/Modules/ThirdParty/ZLIB/src -I/src/ITK/build_icc/Modules/ThirdParty/GDCM -I/src/ITK/build_icc/Modules/ThirdParty/GDCM/src/gdcm/Source/Common -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/Common -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/InformationObjectDefinition -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MessageExchangeDefinition -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEncodingDefinition -I/src/ITK/Modules/IO/GDCM/include -I/src/ITK/Modules/IO/GIPL/include -I/src/ITK/build_icc/Modules/IO/ImageBase -I/src/ITK/Modules/IO/ImageBase/include -I/src/ITK/Modules/IO/JPEG/include -I/src/ITK/build_icc/Modules/ThirdParty/MetaIO/src/MetaIO/src -I/src/ITK/Modules/ThirdParty/MetaIO/src/MetaIO/src -I/src/ITK/Modules/IO/Meta/include -I/src/ITK/Modules/IO/NIFTI/include -I/src/ITK/Modules/IO/NRRD/include -I/src/ITK/Modules/IO/PNG/include -I/src/ITK/Modules/IO/TIFF/include -I/src/ITK/Modules/IO/VTK/include -I/src/ITK/Modules/Core/TestKernel/include -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl Does anyone have a pointer to see where this error comes from? Thank you. -Jon -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _______________________________________________ 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://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-developers From matt.mccormick at kitware.com Wed Apr 5 17:16:51 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Wed, 5 Apr 2017 17:16:51 -0400 Subject: [ITK] [ITK-dev] Build errors using a different C and CXX compiler In-Reply-To: References: Message-ID: Hi Jon, It does not look like we have working builds of ICC on the dashboard [1]. As they say, if it not tested, it is broken. There are two x86_64 ICC builds, but they either have a build system issue, or ITK needs to be updated to use this compiler. What version of the compiler is it? Thanks, Matt [1] https://open.cdash.org/index.php?project=Insight On Wed, Apr 5, 2017 at 4:57 PM, Lefman, Jonathan wrote: > Hi all, > > > > I am attempting to build ITK from source (have tried using v4.11.0 and > master) using a different CXX compiler. To start, I do not have an issue > when I utilize the default compiler (gcc) as much compiler. This works fine; > tests are successful. > > > > The error I encounter on both Ubuntu and Centos systems is the same. It > looks like this on the make output: > > [ 58%] Building CXX object > Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver.dir/itkRayCastInterpolateImageFunctionTest.cxx.o > > /src/ITK/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx(38): > error: member "::RayCastHelper TCoordRep>::InputImageDimension [with TInputImage=itk::Image 3U>, TCoordRep=double]" was referenced but not defined > > itkStaticConstMacro(InputImageDimension, unsigned int, > > ^ > > > > compilation aborted for > /src/ITK/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFunctionTest.cxx > (code 2) > > make[2]: *** > [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver.dir/itkRayCastInterpolateImageFunctionTest.cxx.o] > Error 2 > > make[1]: *** > [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver.dir/all] > Error 2 > > make: *** [all] Error 2 > > > > My cmake setup looks like this: > > CC=/intel/bin/icc CXX=/intel/bin/icc cmake > -DCMAKE_CXX_COMPILER:FILEPATH=$CXX -DCMAKE_C_COMPILER:FILEPATH=$CC > -DModule_PerformanceBenchmarking:BOOL=ON .. > > > > Example generated CXX_FLAGS are from: > ./Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver.dir/flags.make > > # compile CXX with /intel/bin/icc > > CXX_FLAGS = -w2 -wd1268 -wd981 -wd383 -wd1418 -wd1419 -wd2259 -wd1572 > -wd424 -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch > -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -Wno-deprecated > -Wno-invalid-offsetof -Woverloaded-virtual -O3 -DNDEBUG -fPIE > -I/src/ITK/Modules/Core/ImageAdaptors/include > -I/src/ITK/build_icc/Modules/ThirdParty/KWIML/src > -I/src/ITK/Modules/ThirdParty/KWIML/src > -I/src/ITK/build_icc/Modules/ThirdParty/KWSys/src > -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/v3p/netlib > -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/vcl > -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core > -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/v3p/netlib > -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/vcl > -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/core > -I/src/ITK/Modules/ThirdParty/VNLInstantiation/include > -I/src/ITK/build_icc/Modules/Core/Common > -I/src/ITK/Modules/Core/Common/include > -I/src/ITK/build_icc/Modules/ThirdParty/Netlib > -I/src/ITK/Modules/Numerics/Statistics/include > -I/src/ITK/Modules/Filtering/ImageFilterBase/include > -I/src/ITK/Modules/Core/Transform/include > -I/src/ITK/Modules/Core/ImageFunction/include > -I/src/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion > -I/src/ITK/build_icc/Modules/ThirdParty/DoubleConversion/src/double-conversion > -I/src/ITK/Modules/IO/BMP/include > -I/src/ITK/build_icc/Modules/ThirdParty/Expat/src/expat > -I/src/ITK/Modules/ThirdParty/Expat/src/expat > -I/src/ITK/build_icc/Modules/ThirdParty/ZLIB/src > -I/src/ITK/Modules/ThirdParty/ZLIB/src > -I/src/ITK/build_icc/Modules/ThirdParty/GDCM > -I/src/ITK/build_icc/Modules/ThirdParty/GDCM/src/gdcm/Source/Common > -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat > -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary > -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/Common > -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/InformationObjectDefinition > -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MessageExchangeDefinition > -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEncodingDefinition > -I/src/ITK/Modules/IO/GDCM/include -I/src/ITK/Modules/IO/GIPL/include > -I/src/ITK/build_icc/Modules/IO/ImageBase > -I/src/ITK/Modules/IO/ImageBase/include -I/src/ITK/Modules/IO/JPEG/include > -I/src/ITK/build_icc/Modules/ThirdParty/MetaIO/src/MetaIO/src > -I/src/ITK/Modules/ThirdParty/MetaIO/src/MetaIO/src > -I/src/ITK/Modules/IO/Meta/include -I/src/ITK/Modules/IO/NIFTI/include > -I/src/ITK/Modules/IO/NRRD/include -I/src/ITK/Modules/IO/PNG/include > -I/src/ITK/Modules/IO/TIFF/include -I/src/ITK/Modules/IO/VTK/include > -I/src/ITK/Modules/Core/TestKernel/include > -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo > -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl > > > > Does anyone have a pointer to see where this error comes from? Thank you. > > > > -Jon > > _______________________________________________ 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://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-developers From mafuentes at uclv.cu Wed Apr 5 20:46:53 2017 From: mafuentes at uclv.cu (Manuel Alejandro Castro Fuentes) Date: Wed, 5 Apr 2017 17:46:53 -0700 Subject: [ITK] ItkVtkGlue In-Reply-To: References: <82fe70de-2b94-2ab4-c3b5-030a7d8f7e93@uclv.cu> Message-ID: <622f3f03-2970-3cc5-cff1-271bc13335db@uclv.cu> That fixes the issue Thanks a lot, Manuel El 4/5/2017 a las 12:57 PM, Matt McCormick escribi?: > Hi Manuel, > > I was able to create an import error, and then it was resolved by > adding the directory with the file vtkImagingCorePython35D-7.1.dll to > the PATH environmental variable. > > Hope this helps, > Matt > > On Mon, Apr 3, 2017 at 3:23 PM, Matt McCormick > wrote: >> Hi Manuel, >> >> Thanks for discussing the issue. >> >> I will see if I can reproduce the problem. >> >> Thanks, >> Matt >> >> On Tue, Mar 28, 2017 at 11:31 AM, Manuel Alejandro Castro Fuentes >> wrote: >>> Hello >>> >>> I'm building InsightToolkit-4.11.0 on Visual Studio 2015 with >>> ITK_WRAP_PYTHON=ON and Module_ITKVtkGlue=ON, for Python 3.5.3 and VTK 7.1.0. >>> The building process has no errors but when I try something like: >>> >>> filter = itk.ImageToVTKImageFilter[itk.Image[itk.UC, 3]].New() >>> >>> I got this error: >>> >>> Traceback (most recent call last): >>> File "", line 1, in >>> File "D:\Builds\ITK-4.11.0\Wrapping\Generators\Python\Release\itkLazy.py", >>> line 44, in __getattribute__ >>> itkBase.LoadModule(module, namespace) >>> File "D:\Builds\ITK-4.11.0\Wrapping\Generators\Python\Release\itkBase.py", >>> line 63, in LoadModule >>> swig.__dict__.update(this_module.swig.__dict__) >>> AttributeError: module 'ITKVtkGlue' has no attribute 'swig' >>> >>> Other modules work just fine as far as I have tried. I have done some things >>> with ITK+VTK+Python but using the Python(x,y) distribution, this is the >>> first time I'm building them from the source and wrapping them for Python. >>> If anyone can point me in the direction of a solution or an answer as to >>> what this may happen will be greatly appreciated. >>> >>> Thanks in advance >>> Manuel >>> _______________________________________________ >>> Community mailing list >>> Community at itk.org >>> http://public.kitware.com/mailman/listinfo/community From sidharta.gupta93 at gmail.com Thu Apr 6 08:34:14 2017 From: sidharta.gupta93 at gmail.com (sidharta) Date: Thu, 6 Apr 2017 05:34:14 -0700 (MST) Subject: [ITK] [ITK-users] Extract slice from ResampleFilter Message-ID: <1491482054290-38074.post@n7.nabble.com> Dear all, I am trying to extract density profile along a trajectory in CT. Using some adjustments to contour-based segmentation and getting a mesh from the binary mask, I computed certain trajectories tangential to certain faces/vertices of the mesh. Now, I have the coordinates of the target point and a tangent to the target. So, depending on the spacing, I extract all the points along the tangent which are 5mm away from the target. I am using following code to generate densities after I have got the physical coordinates along this line. void generateDensities(std::vector points, InternalImageType::Pointer image){ InternalImageType::IndexType pixelIndex; PointType point; itk::ContinuousIndex pixel; linearInterpolationContinuousIndexType::Pointer interpolate = linearInterpolationContinuousIndexType::New(); interpolate->SetInputImage(image); std::vector HU_values; std::vector HU_values_interpolate; std::vector Pixel_indices; std::vector> Pixel_indices_interpolated; // std::cout << "Generating with interpolation" << std::endl; for (int i = 0; i < points.size(); i++) { Vector3d temp_point = points.at(i); point[0] = temp_point[0]; point[1] = temp_point[1]; point[2] = temp_point[2]; // std::cout << "Getting continuous index " << std::endl; bool isInside = image->TransformPhysicalPointToContinuousIndex(point, pixel); if (isInside) { InternalImageType::PixelType pixelValue = interpolate->EvaluateAtContinuousIndex(pixel); HU_values_interpolate.push_back(pixelValue); Pixel_indices_interpolated.push_back(pixel); } else std::cout << "Point " << point << " with index " << pixel << "is outside" << std::endl; } All_HU_values_interpolated.push_back(HU_values_interpolate); All_pixel_indices_interpolated.push_back(Pixel_indices_interpolated); HU_values_interpolate.clear(); HU_values.clear(); } Now, for verification that I am actually getting in fact the correct values, I would like to extract the oblique slice along this trajectory and I figure I have to use the Resample filter to "transform" the CT so that rotation puts the resampled CT coordinate system parallel to the trajectory and the origin translated to the start of the trajectory. Now, along the trajectory, with the set of collinear points (along the trajectory), I can get a lot of planes (oblique slices essentially) which have the trajectory in them. So to get around this, I figure if I give another point which is non-collinear to these points, I can specify the exact oblique slice I want. However, this is something I have to figure out for a lot of trajectories for the same CT and then correspondingly for others. Can someone tell me how can I achieve this "automatically" for all trajectories/CTs? PS. All CTs have the same spacing and origin. Kindly also mention if you think the function for generating the densities is correct or not? Eitherways I would like to validate. Thank you, Sidharta -- View this message in context: http://itk-users.7.n7.nabble.com/Extract-slice-from-ResampleFilter-tp38074.html Sent from the ITK - 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 From francois.budin at kitware.com Thu Apr 6 09:27:58 2017 From: francois.budin at kitware.com (Francois Budin) Date: Thu, 6 Apr 2017 09:27:58 -0400 Subject: [ITK] [ITK-users] Patch for ApproximateSignedDistanceMapImageFilter In-Reply-To: References: <874f690f-ff74-bb01-6d1e-bc479abeb547@neuro.ma.uni-heidelberg.de> Message-ID: Thanks Christina for taking care of this problem! The patch you submitted looks good to me. It would be perfect if you could create a test using the images your generate to ensure that the problem does not appear again in the future. Francois On Mon, Apr 3, 2017 at 3:18 PM, Matt McCormick wrote: > Hi Christina, > > > 2nd attempt using approach 1) (see below). What about typos in comments > I > > removed during bug fixing? Include into this patch as well or keep them > > separate? > > Thanks! This patch has been uploaded: > > http://review.source.kitware.com/#/c/22149/3 > > > The typos could go in a different patch (ideally), but it is OK, if > they are included. > > Thanks, > Matt > > > > > Additionally you find a small application creating an image with a bright > > square on dark background which displays the image together with the > result > > of ApproximateSignedDistanceMapImageFilter. The pixel value of the > square is > > 1 by default but can be changed via command line. > > > > Regards, > > Christina > > > > > > On 29.03.2017 15:12, Francois Budin wrote: > > > > Hello Christina, > > > > I see different paths to try to solve this issue and I am not sure which > one > > is the best one: > > 1) You could modify the itkIsoContourDistanceImageFilter class so that > > m_LevelSetValue is of some real type. When looking in the implementation > of > > this filter, you can see that sometimes, m_LevelSetValue is casted to a > > real type [1], so maybe it makes sense to do that. > > 2) Casting is one solution, but you have to be careful if you want to > cast > > to float or double. If you cast to float, and the input is of type > double, > > you will loose precision. If you always cast to double, you might use a > lot > > of memory. Sadly, in the itkNumericTraits, there is no way of asking for > > "the smallest floating type that contains my current type". You can call > > "RealType" which will be "double", or "FloatType" which will be float. > One > > strength of casting, is that if you perform it in place, it can actually > not > > do anything if it doesn't need to [2]. > > 3) To avoid casting when you don't need to (your type is float or > double), > > you could use the SFINAE concept like it is used here [3]. This is more > > complex and may not be worth it. > > > > Beware that images may contain pixels that are not only scalar values, > but > > also RGB, RGBA, vectors. I am not sure if the ApproximateDistance filter > > supports these types, but it is good to be careful, when modifying the > code, > > to not restrict the usage of a filter to scalar if not required. To avoid > > that kind of issues, and to answer your original question, you can use > the > > Rebind structure [4]. > > > > I hope this helps. > > I will be out of town for a week, and most likely will have limited to no > > access to the internet, so don't be surprised if I do not answer your > next > > message within the next week. > > > > Thanks for helping! > > Francois > > > > [1] > > https://github.com/InsightSoftwareConsortium/ITK/ > blob/master/Modules/Filtering/DistanceMap/include/ > itkIsoContourDistanceImageFilter.hxx#L314 > > [2] > > https://github.com/InsightSoftwareConsortium/ITK/ > blob/master/Modules/Filtering/ImageFilterBase/include/ > itkCastImageFilter.hxx#L42 > > [3] > > https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/IO/ > ImageBase/include/itkConvertPixelBuffer.h#L153-L161 > > [4] > > https://github.com/InsightSoftwareConsortium/ITK/ > blob/master/Modules/Filtering/Smoothing/include/ > itkSmoothingRecursiveGaussianImageFilter.h#L84-L85 > > > > On Wed, Mar 29, 2017 at 7:10 AM, Chr. Rossmanith > > wrote: > >> > >> Hi Francois, > >> > >> I'm getting back to this issue. I'll introduce an intermediate image in > >> the mini pipeline used in ApproximateSignedDistanceMapImageFilter > which has > >> a floating type for pixel values. Given > >> > >> /** Type for input image. */ > >> typedef TInputImage InputImageType; > >> > >> how can I define a corresponding image type FloatImageType replacing the > >> unknown pixel type by float? I can't write itk::Image< float, xxx > > because > >> I don't know xxx. > >> > >> Is there a way to query the pixel type to avoid applying the > >> CastImageFilter in case we already get floating valued pixels? > >> > >> Christina > >> > >> > >> > >> On 03.03.2017 14:58, Francois Budin wrote: > >> > >> Hi Christina, > >> > >> Maybe your idea was good but needs more work (e.g. cast the input image > to > >> the output type? at least if input is not a float, or maybe something > else). > >> I am glad you found a solution that works for you. If you need your > software > >> to be faster, you can also replace the SignedDanielssonDistanceMap with > the > >> SignedMauerDistanceMap [1]. > >> > >> Hope this helps, and thanks for your contribution. Do not hesitate to > >> submit a new patch to solve your original problem if you find a > solution. > >> > >> Francois > >> [1] > >> https://itk.org/Doxygen/html/classitk_1_1SignedMaurerDistanceMapImageF > ilter.html > >> > >> On Fri, Mar 3, 2017 at 8:23 AM, Chr. Rossmanith > >> wrote: > >>> > >>> Hi Francois, > >>> > >>> really strange, on Wednesday changing the data type made my application > >>> work as expected (but obviously there must have been an additional > change > >>> which really made the application work...). When trying to build a > small > >>> example for you, I failed. I still think that feeding a 0/1 image into > >>> ApproximateSignedDistanceMapImageFilter makes sense. > >>> > >>> Originally I'm interested in ContourExtractor2D, which operates on a > >>> distance map using 0 as contour level. Unlike in the > ContourExtractor2D > >>> example I've decided to use SignedDanielssonDistanceMap which works > fine > >>> without any patches. > >>> > >>> So send the patch to /dev/null for the moment... > >>> > >>> Christina > >>> > >>> > >>> On 02.03.2017 16:17, Francois Budin wrote: > >>> > >>> Hello Christina, > >>> > >>> I just reviewed you patch. You are changing the type of the variable > >>> levelSetValue to OutputPixelType which is suppose to be a floating > point > >>> value. > >>> However, the computation is done with InputPixelType variables > >>> (m_InsideValue and m_OutsideValue) and divided by an integer. > Additionally, > >>> the resulting value is used in: > >>> m_IsoContourFilter->SetLevelSetValue(levelSetValue); > >>> > >>> which accepts values of InputPixelType [1] since IsoContourType is > >>> defined as: > >>> typedef IsoContourDistanceImageFilter< InputImageType, > OutputImageType > >>> > IsoContourType; > >>> > >>> I am not sure if your patch solves the problem that you mentioned. Do > you > >>> have a test that would verify that the new behavior corresponds to your > >>> expectations? Based on the code review I have done, I would not expect > the > >>> behavior of the filter to change. > >>> > >>> Let me know if I missed a detail. Thank you for your contribution! > >>> Francois > >>> > >>> [1] > >>> https://itk.org/Doxygen/html/classitk_1_1IsoContourDistanceImageFilter > .html > >>> > >>> On Wed, Mar 1, 2017 at 8:12 AM, Chr. Rossmanith > >>> wrote: > >>>> > >>>> For binary images with 0 for background and 1 for objects with an > >>>> integer input pixel type there is a problem representing the average > of 0 > >>>> and 1 = 0.5 with the input pixel type. The output pixel type is > required to > >>>> be a floating pixel type (filter documentation), so it should be safe > to > >>>> change the type of levelSetValue to OutputPixelType. > >>>> > >>>> Regards, > >>>> Christina > >>>> > >>>> > >>>> _____________________________________ > >>>> 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 > >>>> > >>> > >>> > >> > >> > > > > > > > > _____________________________________ > > 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 > > > _____________________________________ > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From jonathan.lefman at intel.com Thu Apr 6 15:35:12 2017 From: jonathan.lefman at intel.com (Lefman, Jonathan) Date: Thu, 6 Apr 2017 19:35:12 +0000 Subject: [ITK] [ITK-dev] Build errors using a different C and CXX compiler In-Reply-To: References: Message-ID: Matt, I just met with a technical lead for the Intel compiler front-end group to review this issue. I may have uncovered a bug in the front-end logic. They are investigating to dig into the reason for this anomaly. When I receive their analysis, I will report back what the next steps are. -Jon -----Original Message----- From: Matt McCormick [mailto:matt.mccormick at kitware.com] Sent: Wednesday, April 5, 2017 5:17 PM To: Lefman, Jonathan Cc: insight-developers at itk.org Subject: Re: Build errors using a different C and CXX compiler Hi Jon, It does not look like we have working builds of ICC on the dashboard [1]. As they say, if it not tested, it is broken. There are two x86_64 ICC builds, but they either have a build system issue, or ITK needs to be updated to use this compiler. What version of the compiler is it? Thanks, Matt [1] https://open.cdash.org/index.php?project=Insight On Wed, Apr 5, 2017 at 4:57 PM, Lefman, Jonathan wrote: > Hi all, > > > > I am attempting to build ITK from source (have tried using v4.11.0 and > master) using a different CXX compiler. To start, I do not have an > issue when I utilize the default compiler (gcc) as much compiler. This > works fine; tests are successful. > > > > The error I encounter on both Ubuntu and Centos systems is the same. > It looks like this on the make output: > > [ 58%] Building CXX object > Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver. > dir/itkRayCastInterpolateImageFunctionTest.cxx.o > > /src/ITK/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx(38): > error: member "::RayCastHelper TCoordRep>::InputImageDimension [with TInputImage=itk::Image TCoordRep>char, > 3U>, TCoordRep=double]" was referenced but not defined > > itkStaticConstMacro(InputImageDimension, unsigned int, > > ^ > > > > compilation aborted for > /src/ITK/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFun > ctionTest.cxx > (code 2) > > make[2]: *** > [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver > .dir/itkRayCastInterpolateImageFunctionTest.cxx.o] > Error 2 > > make[1]: *** > [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver > .dir/all] > Error 2 > > make: *** [all] Error 2 > > > > My cmake setup looks like this: > > CC=/intel/bin/icc CXX=/intel/bin/icc cmake > -DCMAKE_CXX_COMPILER:FILEPATH=$CXX -DCMAKE_C_COMPILER:FILEPATH=$CC > -DModule_PerformanceBenchmarking:BOOL=ON .. > > > > Example generated CXX_FLAGS are from: > ./Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDrive > r.dir/flags.make > > # compile CXX with /intel/bin/icc > > CXX_FLAGS = -w2 -wd1268 -wd981 -wd383 -wd1418 -wd1419 -wd2259 -wd1572 > -wd424 -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch > -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -Wno-deprecated > -Wno-invalid-offsetof -Woverloaded-virtual -O3 -DNDEBUG -fPIE > -I/src/ITK/Modules/Core/ImageAdaptors/include > -I/src/ITK/build_icc/Modules/ThirdParty/KWIML/src > -I/src/ITK/Modules/ThirdParty/KWIML/src > -I/src/ITK/build_icc/Modules/ThirdParty/KWSys/src > -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/v3p/netlib > -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/vcl > -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core > -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/v3p/netlib > -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/vcl > -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/core > -I/src/ITK/Modules/ThirdParty/VNLInstantiation/include > -I/src/ITK/build_icc/Modules/Core/Common > -I/src/ITK/Modules/Core/Common/include > -I/src/ITK/build_icc/Modules/ThirdParty/Netlib > -I/src/ITK/Modules/Numerics/Statistics/include > -I/src/ITK/Modules/Filtering/ImageFilterBase/include > -I/src/ITK/Modules/Core/Transform/include > -I/src/ITK/Modules/Core/ImageFunction/include > -I/src/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion > -I/src/ITK/build_icc/Modules/ThirdParty/DoubleConversion/src/double-co > nversion > -I/src/ITK/Modules/IO/BMP/include > -I/src/ITK/build_icc/Modules/ThirdParty/Expat/src/expat > -I/src/ITK/Modules/ThirdParty/Expat/src/expat > -I/src/ITK/build_icc/Modules/ThirdParty/ZLIB/src > -I/src/ITK/Modules/ThirdParty/ZLIB/src > -I/src/ITK/build_icc/Modules/ThirdParty/GDCM > -I/src/ITK/build_icc/Modules/ThirdParty/GDCM/src/gdcm/Source/Common > -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFile > Format > -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary > -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/Common > -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/InformationObjectDe > finition > -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MessageExchangeDefi > nition > -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEnc > odingDefinition -I/src/ITK/Modules/IO/GDCM/include > -I/src/ITK/Modules/IO/GIPL/include > -I/src/ITK/build_icc/Modules/IO/ImageBase > -I/src/ITK/Modules/IO/ImageBase/include > -I/src/ITK/Modules/IO/JPEG/include > -I/src/ITK/build_icc/Modules/ThirdParty/MetaIO/src/MetaIO/src > -I/src/ITK/Modules/ThirdParty/MetaIO/src/MetaIO/src > -I/src/ITK/Modules/IO/Meta/include -I/src/ITK/Modules/IO/NIFTI/include > -I/src/ITK/Modules/IO/NRRD/include -I/src/ITK/Modules/IO/PNG/include > -I/src/ITK/Modules/IO/TIFF/include -I/src/ITK/Modules/IO/VTK/include > -I/src/ITK/Modules/Core/TestKernel/include > -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo > -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl > > > > Does anyone have a pointer to see where this error comes from? Thank you. > > > > -Jon > > _______________________________________________ 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://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-developers From matt.mccormick at kitware.com Thu Apr 6 15:40:07 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Thu, 6 Apr 2017 15:40:07 -0400 Subject: [ITK] [ITK-dev] Build errors using a different C and CXX compiler In-Reply-To: References: Message-ID: Excellent, thanks, Jon! On Thu, Apr 6, 2017 at 3:35 PM, Lefman, Jonathan wrote: > Matt, > > I just met with a technical lead for the Intel compiler front-end group to review this issue. I may have uncovered a bug in the front-end logic. They are investigating to dig into the reason for this anomaly. When I receive their analysis, I will report back what the next steps are. > > -Jon > > -----Original Message----- > From: Matt McCormick [mailto:matt.mccormick at kitware.com] > Sent: Wednesday, April 5, 2017 5:17 PM > To: Lefman, Jonathan > Cc: insight-developers at itk.org > Subject: Re: Build errors using a different C and CXX compiler > > Hi Jon, > > It does not look like we have working builds of ICC on the dashboard [1]. As they say, if it not tested, it is broken. There are two x86_64 ICC builds, but they either have a build system issue, or ITK needs to be updated to use this compiler. What version of the compiler is it? > > Thanks, > Matt > > [1] https://open.cdash.org/index.php?project=Insight > > On Wed, Apr 5, 2017 at 4:57 PM, Lefman, Jonathan wrote: >> Hi all, >> >> >> >> I am attempting to build ITK from source (have tried using v4.11.0 and >> master) using a different CXX compiler. To start, I do not have an >> issue when I utilize the default compiler (gcc) as much compiler. This >> works fine; tests are successful. >> >> >> >> The error I encounter on both Ubuntu and Centos systems is the same. >> It looks like this on the make output: >> >> [ 58%] Building CXX object >> Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver. >> dir/itkRayCastInterpolateImageFunctionTest.cxx.o >> >> /src/ITK/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx(38): >> error: member "::RayCastHelper> TCoordRep>::InputImageDimension [with TInputImage=itk::Image> TCoordRep>char, >> 3U>, TCoordRep=double]" was referenced but not defined >> >> itkStaticConstMacro(InputImageDimension, unsigned int, >> >> ^ >> >> >> >> compilation aborted for >> /src/ITK/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFun >> ctionTest.cxx >> (code 2) >> >> make[2]: *** >> [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver >> .dir/itkRayCastInterpolateImageFunctionTest.cxx.o] >> Error 2 >> >> make[1]: *** >> [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver >> .dir/all] >> Error 2 >> >> make: *** [all] Error 2 >> >> >> >> My cmake setup looks like this: >> >> CC=/intel/bin/icc CXX=/intel/bin/icc cmake >> -DCMAKE_CXX_COMPILER:FILEPATH=$CXX -DCMAKE_C_COMPILER:FILEPATH=$CC >> -DModule_PerformanceBenchmarking:BOOL=ON .. >> >> >> >> Example generated CXX_FLAGS are from: >> ./Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDrive >> r.dir/flags.make >> >> # compile CXX with /intel/bin/icc >> >> CXX_FLAGS = -w2 -wd1268 -wd981 -wd383 -wd1418 -wd1419 -wd2259 -wd1572 >> -wd424 -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch >> -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -Wno-deprecated >> -Wno-invalid-offsetof -Woverloaded-virtual -O3 -DNDEBUG -fPIE >> -I/src/ITK/Modules/Core/ImageAdaptors/include >> -I/src/ITK/build_icc/Modules/ThirdParty/KWIML/src >> -I/src/ITK/Modules/ThirdParty/KWIML/src >> -I/src/ITK/build_icc/Modules/ThirdParty/KWSys/src >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/v3p/netlib >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/vcl >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core >> -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/v3p/netlib >> -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/vcl >> -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/core >> -I/src/ITK/Modules/ThirdParty/VNLInstantiation/include >> -I/src/ITK/build_icc/Modules/Core/Common >> -I/src/ITK/Modules/Core/Common/include >> -I/src/ITK/build_icc/Modules/ThirdParty/Netlib >> -I/src/ITK/Modules/Numerics/Statistics/include >> -I/src/ITK/Modules/Filtering/ImageFilterBase/include >> -I/src/ITK/Modules/Core/Transform/include >> -I/src/ITK/Modules/Core/ImageFunction/include >> -I/src/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion >> -I/src/ITK/build_icc/Modules/ThirdParty/DoubleConversion/src/double-co >> nversion >> -I/src/ITK/Modules/IO/BMP/include >> -I/src/ITK/build_icc/Modules/ThirdParty/Expat/src/expat >> -I/src/ITK/Modules/ThirdParty/Expat/src/expat >> -I/src/ITK/build_icc/Modules/ThirdParty/ZLIB/src >> -I/src/ITK/Modules/ThirdParty/ZLIB/src >> -I/src/ITK/build_icc/Modules/ThirdParty/GDCM >> -I/src/ITK/build_icc/Modules/ThirdParty/GDCM/src/gdcm/Source/Common >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFile >> Format >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/Common >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/InformationObjectDe >> finition >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MessageExchangeDefi >> nition >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEnc >> odingDefinition -I/src/ITK/Modules/IO/GDCM/include >> -I/src/ITK/Modules/IO/GIPL/include >> -I/src/ITK/build_icc/Modules/IO/ImageBase >> -I/src/ITK/Modules/IO/ImageBase/include >> -I/src/ITK/Modules/IO/JPEG/include >> -I/src/ITK/build_icc/Modules/ThirdParty/MetaIO/src/MetaIO/src >> -I/src/ITK/Modules/ThirdParty/MetaIO/src/MetaIO/src >> -I/src/ITK/Modules/IO/Meta/include -I/src/ITK/Modules/IO/NIFTI/include >> -I/src/ITK/Modules/IO/NRRD/include -I/src/ITK/Modules/IO/PNG/include >> -I/src/ITK/Modules/IO/TIFF/include -I/src/ITK/Modules/IO/VTK/include >> -I/src/ITK/Modules/Core/TestKernel/include >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl >> >> >> >> Does anyone have a pointer to see where this error comes from? Thank you. >> >> >> >> -Jon >> >> _______________________________________________ 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://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-developers From tofijoy at gmail.com Fri Apr 7 11:56:46 2017 From: tofijoy at gmail.com (Fijoy Vadakkumpadan) Date: Fri, 7 Apr 2017 11:56:46 -0400 Subject: [ITK] Detecting DICOM file Message-ID: Hello, Does ITK offer a function to determine whether or not a given file path corresponds to a DICOM image? Asking because DICOM standard does not require file names to have a ".dcm" or any other extension. Thanks, --Fijoy -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.mccormick at kitware.com Fri Apr 7 12:48:20 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Fri, 7 Apr 2017 12:48:20 -0400 Subject: [ITK] [ITK-dev] Intel performance meeting notes Message-ID: Hi folks, Here are some links collected at the meeting today on performance optimization with Intel hardware: https://itk.org/Wiki/ITK/PerformanceOptimization#2017-04-07 If anyone else would like to join, we will continue the discussion on the weekly video chat: https://calendar.google.com/calendar/embed?src=jhm9h5t9un1gbm21jktej2qvh0%40group.calendar.google.com&ctz=America/New_York Thanks, Matt _______________________________________________ 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://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-developers From dzenanz at gmail.com Fri Apr 7 13:17:28 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Fri, 7 Apr 2017 13:17:28 -0400 Subject: [ITK] Detecting DICOM file In-Reply-To: References: Message-ID: Hi Fijoy, I am not sure about such a function, but you could try reading it using gdcm reader IO, and if it throws an exception it is not. Regards, D?enan On Fri, Apr 7, 2017 at 11:56 AM, Fijoy Vadakkumpadan wrote: > Hello, > > Does ITK offer a function to determine whether or not a given file path > corresponds to a DICOM image? > > Asking because DICOM standard does not require file names to have a ".dcm" > or any other extension. > > Thanks, > --Fijoy > > _______________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tofijoy at gmail.com Fri Apr 7 13:28:03 2017 From: tofijoy at gmail.com (Fijoy Vadakkumpadan) Date: Fri, 7 Apr 2017 13:28:03 -0400 Subject: [ITK] Detecting DICOM file In-Reply-To: References: Message-ID: Hi D?enan, I just found that itk::GDCMImageIO has a CanReadFile() function. I'll try that. Thanks, --Fijoy On Fri, Apr 7, 2017 at 1:17 PM, D?enan Zuki? wrote: > Hi Fijoy, > > I am not sure about such a function, but you could try reading it using > gdcm reader IO, and if it throws an exception it is not. > > Regards, > D?enan > > On Fri, Apr 7, 2017 at 11:56 AM, Fijoy Vadakkumpadan > wrote: > >> Hello, >> >> Does ITK offer a function to determine whether or not a given file path >> corresponds to a DICOM image? >> >> Asking because DICOM standard does not require file names to have a >> ".dcm" or any other extension. >> >> Thanks, >> --Fijoy >> >> _______________________________________________ >> Community mailing list >> Community at itk.org >> http://public.kitware.com/mailman/listinfo/community >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonathan.lefman at intel.com Fri Apr 7 13:49:29 2017 From: jonathan.lefman at intel.com (Lefman, Jonathan) Date: Fri, 7 Apr 2017 17:49:29 +0000 Subject: [ITK] [ITK-dev] Build errors using a different C and CXX compiler In-Reply-To: References: Message-ID: There is a confirmed bug in the latest release of the Intel Compiler. Any code which compiles in gcc should compile under icc. There is a workaround listed in the last comment here: https://software.intel.com/en-us/comment/1902247. I will notify once a fix has been released. I will try to find out if we can include ITK in regular build tests for ICC development. -Jon -----Original Message----- From: Matt McCormick [mailto:matt.mccormick at kitware.com] Sent: Thursday, April 6, 2017 3:40 PM To: Lefman, Jonathan Cc: insight-developers at itk.org Subject: Re: Build errors using a different C and CXX compiler Excellent, thanks, Jon! On Thu, Apr 6, 2017 at 3:35 PM, Lefman, Jonathan wrote: > Matt, > > I just met with a technical lead for the Intel compiler front-end group to review this issue. I may have uncovered a bug in the front-end logic. They are investigating to dig into the reason for this anomaly. When I receive their analysis, I will report back what the next steps are. > > -Jon > > -----Original Message----- > From: Matt McCormick [mailto:matt.mccormick at kitware.com] > Sent: Wednesday, April 5, 2017 5:17 PM > To: Lefman, Jonathan > Cc: insight-developers at itk.org > Subject: Re: Build errors using a different C and CXX compiler > > Hi Jon, > > It does not look like we have working builds of ICC on the dashboard [1]. As they say, if it not tested, it is broken. There are two x86_64 ICC builds, but they either have a build system issue, or ITK needs to be updated to use this compiler. What version of the compiler is it? > > Thanks, > Matt > > [1] https://open.cdash.org/index.php?project=Insight > > On Wed, Apr 5, 2017 at 4:57 PM, Lefman, Jonathan wrote: >> Hi all, >> >> >> >> I am attempting to build ITK from source (have tried using v4.11.0 >> and >> master) using a different CXX compiler. To start, I do not have an >> issue when I utilize the default compiler (gcc) as much compiler. >> This works fine; tests are successful. >> >> >> >> The error I encounter on both Ubuntu and Centos systems is the same. >> It looks like this on the make output: >> >> [ 58%] Building CXX object >> Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver. >> dir/itkRayCastInterpolateImageFunctionTest.cxx.o >> >> /src/ITK/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx(38): >> error: member "::RayCastHelper> TCoordRep>::InputImageDimension [with TInputImage=itk::Image> TCoordRep>char, >> 3U>, TCoordRep=double]" was referenced but not defined >> >> itkStaticConstMacro(InputImageDimension, unsigned int, >> >> ^ >> >> >> >> compilation aborted for >> /src/ITK/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFu >> n >> ctionTest.cxx >> (code 2) >> >> make[2]: *** >> [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDrive >> r .dir/itkRayCastInterpolateImageFunctionTest.cxx.o] >> Error 2 >> >> make[1]: *** >> [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDrive >> r >> .dir/all] >> Error 2 >> >> make: *** [all] Error 2 >> >> >> >> My cmake setup looks like this: >> >> CC=/intel/bin/icc CXX=/intel/bin/icc cmake >> -DCMAKE_CXX_COMPILER:FILEPATH=$CXX -DCMAKE_C_COMPILER:FILEPATH=$CC >> -DModule_PerformanceBenchmarking:BOOL=ON .. >> >> >> >> Example generated CXX_FLAGS are from: >> ./Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriv >> e >> r.dir/flags.make >> >> # compile CXX with /intel/bin/icc >> >> CXX_FLAGS = -w2 -wd1268 -wd981 -wd383 -wd1418 -wd1419 -wd2259 -wd1572 >> -wd424 -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch >> -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -Wno-deprecated >> -Wno-invalid-offsetof -Woverloaded-virtual -O3 -DNDEBUG -fPIE >> -I/src/ITK/Modules/Core/ImageAdaptors/include >> -I/src/ITK/build_icc/Modules/ThirdParty/KWIML/src >> -I/src/ITK/Modules/ThirdParty/KWIML/src >> -I/src/ITK/build_icc/Modules/ThirdParty/KWSys/src >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/v3p/netlib >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/vcl >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core >> -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/v3p/netlib >> -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/vcl >> -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/core >> -I/src/ITK/Modules/ThirdParty/VNLInstantiation/include >> -I/src/ITK/build_icc/Modules/Core/Common >> -I/src/ITK/Modules/Core/Common/include >> -I/src/ITK/build_icc/Modules/ThirdParty/Netlib >> -I/src/ITK/Modules/Numerics/Statistics/include >> -I/src/ITK/Modules/Filtering/ImageFilterBase/include >> -I/src/ITK/Modules/Core/Transform/include >> -I/src/ITK/Modules/Core/ImageFunction/include >> -I/src/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion >> -I/src/ITK/build_icc/Modules/ThirdParty/DoubleConversion/src/double-c >> o >> nversion >> -I/src/ITK/Modules/IO/BMP/include >> -I/src/ITK/build_icc/Modules/ThirdParty/Expat/src/expat >> -I/src/ITK/Modules/ThirdParty/Expat/src/expat >> -I/src/ITK/build_icc/Modules/ThirdParty/ZLIB/src >> -I/src/ITK/Modules/ThirdParty/ZLIB/src >> -I/src/ITK/build_icc/Modules/ThirdParty/GDCM >> -I/src/ITK/build_icc/Modules/ThirdParty/GDCM/src/gdcm/Source/Common >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFil >> e >> Format >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/Common >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/InformationObjectD >> e >> finition >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MessageExchangeDef >> i >> nition >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEn >> c odingDefinition -I/src/ITK/Modules/IO/GDCM/include >> -I/src/ITK/Modules/IO/GIPL/include >> -I/src/ITK/build_icc/Modules/IO/ImageBase >> -I/src/ITK/Modules/IO/ImageBase/include >> -I/src/ITK/Modules/IO/JPEG/include >> -I/src/ITK/build_icc/Modules/ThirdParty/MetaIO/src/MetaIO/src >> -I/src/ITK/Modules/ThirdParty/MetaIO/src/MetaIO/src >> -I/src/ITK/Modules/IO/Meta/include >> -I/src/ITK/Modules/IO/NIFTI/include >> -I/src/ITK/Modules/IO/NRRD/include -I/src/ITK/Modules/IO/PNG/include >> -I/src/ITK/Modules/IO/TIFF/include -I/src/ITK/Modules/IO/VTK/include >> -I/src/ITK/Modules/Core/TestKernel/include >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl >> >> >> >> Does anyone have a pointer to see where this error comes from? Thank you. >> >> >> >> -Jon >> >> _______________________________________________ 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://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-developers From matt.mccormick at kitware.com Fri Apr 7 14:10:58 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Fri, 7 Apr 2017 14:10:58 -0400 Subject: [ITK] [ITK-dev] Build errors using a different C and CXX compiler In-Reply-To: References: Message-ID: Thanks, Jon! On Fri, Apr 7, 2017 at 1:49 PM, Lefman, Jonathan wrote: > There is a confirmed bug in the latest release of the Intel Compiler. Any code which compiles in gcc should compile under icc. There is a workaround listed in the last comment here: https://software.intel.com/en-us/comment/1902247. I will notify once a fix has been released. I will try to find out if we can include ITK in regular build tests for ICC development. > > -Jon > > -----Original Message----- > From: Matt McCormick [mailto:matt.mccormick at kitware.com] > Sent: Thursday, April 6, 2017 3:40 PM > To: Lefman, Jonathan > Cc: insight-developers at itk.org > Subject: Re: Build errors using a different C and CXX compiler > > Excellent, thanks, Jon! > > On Thu, Apr 6, 2017 at 3:35 PM, Lefman, Jonathan wrote: >> Matt, >> >> I just met with a technical lead for the Intel compiler front-end group to review this issue. I may have uncovered a bug in the front-end logic. They are investigating to dig into the reason for this anomaly. When I receive their analysis, I will report back what the next steps are. >> >> -Jon >> >> -----Original Message----- >> From: Matt McCormick [mailto:matt.mccormick at kitware.com] >> Sent: Wednesday, April 5, 2017 5:17 PM >> To: Lefman, Jonathan >> Cc: insight-developers at itk.org >> Subject: Re: Build errors using a different C and CXX compiler >> >> Hi Jon, >> >> It does not look like we have working builds of ICC on the dashboard [1]. As they say, if it not tested, it is broken. There are two x86_64 ICC builds, but they either have a build system issue, or ITK needs to be updated to use this compiler. What version of the compiler is it? >> >> Thanks, >> Matt >> >> [1] https://open.cdash.org/index.php?project=Insight >> >> On Wed, Apr 5, 2017 at 4:57 PM, Lefman, Jonathan wrote: >>> Hi all, >>> >>> >>> >>> I am attempting to build ITK from source (have tried using v4.11.0 >>> and >>> master) using a different CXX compiler. To start, I do not have an >>> issue when I utilize the default compiler (gcc) as much compiler. >>> This works fine; tests are successful. >>> >>> >>> >>> The error I encounter on both Ubuntu and Centos systems is the same. >>> It looks like this on the make output: >>> >>> [ 58%] Building CXX object >>> Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver. >>> dir/itkRayCastInterpolateImageFunctionTest.cxx.o >>> >>> /src/ITK/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx(38): >>> error: member "::RayCastHelper>> TCoordRep>::InputImageDimension [with TInputImage=itk::Image>> TCoordRep>char, >>> 3U>, TCoordRep=double]" was referenced but not defined >>> >>> itkStaticConstMacro(InputImageDimension, unsigned int, >>> >>> ^ >>> >>> >>> >>> compilation aborted for >>> /src/ITK/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFu >>> n >>> ctionTest.cxx >>> (code 2) >>> >>> make[2]: *** >>> [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDrive >>> r .dir/itkRayCastInterpolateImageFunctionTest.cxx.o] >>> Error 2 >>> >>> make[1]: *** >>> [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDrive >>> r >>> .dir/all] >>> Error 2 >>> >>> make: *** [all] Error 2 >>> >>> >>> >>> My cmake setup looks like this: >>> >>> CC=/intel/bin/icc CXX=/intel/bin/icc cmake >>> -DCMAKE_CXX_COMPILER:FILEPATH=$CXX -DCMAKE_C_COMPILER:FILEPATH=$CC >>> -DModule_PerformanceBenchmarking:BOOL=ON .. >>> >>> >>> >>> Example generated CXX_FLAGS are from: >>> ./Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriv >>> e >>> r.dir/flags.make >>> >>> # compile CXX with /intel/bin/icc >>> >>> CXX_FLAGS = -w2 -wd1268 -wd981 -wd383 -wd1418 -wd1419 -wd2259 -wd1572 >>> -wd424 -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch >>> -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -Wno-deprecated >>> -Wno-invalid-offsetof -Woverloaded-virtual -O3 -DNDEBUG -fPIE >>> -I/src/ITK/Modules/Core/ImageAdaptors/include >>> -I/src/ITK/build_icc/Modules/ThirdParty/KWIML/src >>> -I/src/ITK/Modules/ThirdParty/KWIML/src >>> -I/src/ITK/build_icc/Modules/ThirdParty/KWSys/src >>> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/v3p/netlib >>> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/vcl >>> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core >>> -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/v3p/netlib >>> -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/vcl >>> -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/core >>> -I/src/ITK/Modules/ThirdParty/VNLInstantiation/include >>> -I/src/ITK/build_icc/Modules/Core/Common >>> -I/src/ITK/Modules/Core/Common/include >>> -I/src/ITK/build_icc/Modules/ThirdParty/Netlib >>> -I/src/ITK/Modules/Numerics/Statistics/include >>> -I/src/ITK/Modules/Filtering/ImageFilterBase/include >>> -I/src/ITK/Modules/Core/Transform/include >>> -I/src/ITK/Modules/Core/ImageFunction/include >>> -I/src/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion >>> -I/src/ITK/build_icc/Modules/ThirdParty/DoubleConversion/src/double-c >>> o >>> nversion >>> -I/src/ITK/Modules/IO/BMP/include >>> -I/src/ITK/build_icc/Modules/ThirdParty/Expat/src/expat >>> -I/src/ITK/Modules/ThirdParty/Expat/src/expat >>> -I/src/ITK/build_icc/Modules/ThirdParty/ZLIB/src >>> -I/src/ITK/Modules/ThirdParty/ZLIB/src >>> -I/src/ITK/build_icc/Modules/ThirdParty/GDCM >>> -I/src/ITK/build_icc/Modules/ThirdParty/GDCM/src/gdcm/Source/Common >>> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFil >>> e >>> Format >>> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary >>> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/Common >>> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/InformationObjectD >>> e >>> finition >>> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MessageExchangeDef >>> i >>> nition >>> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEn >>> c odingDefinition -I/src/ITK/Modules/IO/GDCM/include >>> -I/src/ITK/Modules/IO/GIPL/include >>> -I/src/ITK/build_icc/Modules/IO/ImageBase >>> -I/src/ITK/Modules/IO/ImageBase/include >>> -I/src/ITK/Modules/IO/JPEG/include >>> -I/src/ITK/build_icc/Modules/ThirdParty/MetaIO/src/MetaIO/src >>> -I/src/ITK/Modules/ThirdParty/MetaIO/src/MetaIO/src >>> -I/src/ITK/Modules/IO/Meta/include >>> -I/src/ITK/Modules/IO/NIFTI/include >>> -I/src/ITK/Modules/IO/NRRD/include -I/src/ITK/Modules/IO/PNG/include >>> -I/src/ITK/Modules/IO/TIFF/include -I/src/ITK/Modules/IO/VTK/include >>> -I/src/ITK/Modules/Core/TestKernel/include >>> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo >>> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl >>> >>> >>> >>> Does anyone have a pointer to see where this error comes from? Thank you. >>> >>> >>> >>> -Jon >>> >>> _______________________________________________ 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://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-developers From dzenanz at gmail.com Fri Apr 7 14:29:58 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Fri, 7 Apr 2017 14:29:58 -0400 Subject: [ITK] [ITK-dev] Build errors using a different C and CXX compiler In-Reply-To: References: Message-ID: Microsoft already did the same! https://developercommunity.visualstudio.com/comments/6266/view.html ITK is an excellent stress test case for compilers because of big code size and omnipresent templates :) Regards, D?enan On Fri, Apr 7, 2017 at 1:49 PM, Lefman, Jonathan wrote: > There is a confirmed bug in the latest release of the Intel Compiler. Any > code which compiles in gcc should compile under icc. There is a workaround > listed in the last comment here: https://software.intel.com/en- > us/comment/1902247. I will notify once a fix has been released. I will > try to find out if we can include ITK in regular build tests for ICC > development. > > -Jon > > -----Original Message----- > From: Matt McCormick [mailto:matt.mccormick at kitware.com] > Sent: Thursday, April 6, 2017 3:40 PM > To: Lefman, Jonathan > Cc: insight-developers at itk.org > Subject: Re: Build errors using a different C and CXX compiler > > Excellent, thanks, Jon! > > On Thu, Apr 6, 2017 at 3:35 PM, Lefman, Jonathan < > jonathan.lefman at intel.com> wrote: > > Matt, > > > > I just met with a technical lead for the Intel compiler front-end group > to review this issue. I may have uncovered a bug in the front-end logic. > They are investigating to dig into the reason for this anomaly. When I > receive their analysis, I will report back what the next steps are. > > > > -Jon > > > > -----Original Message----- > > From: Matt McCormick [mailto:matt.mccormick at kitware.com] > > Sent: Wednesday, April 5, 2017 5:17 PM > > To: Lefman, Jonathan > > Cc: insight-developers at itk.org > > Subject: Re: Build errors using a different C and CXX compiler > > > > Hi Jon, > > > > It does not look like we have working builds of ICC on the dashboard > [1]. As they say, if it not tested, it is broken. There are two x86_64 ICC > builds, but they either have a build system issue, or ITK needs to be > updated to use this compiler. What version of the compiler is it? > > > > Thanks, > > Matt > > > > [1] https://open.cdash.org/index.php?project=Insight > > > > On Wed, Apr 5, 2017 at 4:57 PM, Lefman, Jonathan < > jonathan.lefman at intel.com> wrote: > >> Hi all, > >> > >> > >> > >> I am attempting to build ITK from source (have tried using v4.11.0 > >> and > >> master) using a different CXX compiler. To start, I do not have an > >> issue when I utilize the default compiler (gcc) as much compiler. > >> This works fine; tests are successful. > >> > >> > >> > >> The error I encounter on both Ubuntu and Centos systems is the same. > >> It looks like this on the make output: > >> > >> [ 58%] Building CXX object > >> Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriver. > >> dir/itkRayCastInterpolateImageFunctionTest.cxx.o > >> > >> /src/ITK/Modules/Core/ImageFunction/include/ > itkRayCastInterpolateImageFunction.hxx(38): > >> error: member "::RayCastHelper >> TCoordRep>::InputImageDimension [with TInputImage=itk::Image >> TCoordRep>char, > >> 3U>, TCoordRep=double]" was referenced but not defined > >> > >> itkStaticConstMacro(InputImageDimension, unsigned int, > >> > >> ^ > >> > >> > >> > >> compilation aborted for > >> /src/ITK/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFu > >> n > >> ctionTest.cxx > >> (code 2) > >> > >> make[2]: *** > >> [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDrive > >> r .dir/itkRayCastInterpolateImageFunctionTest.cxx.o] > >> Error 2 > >> > >> make[1]: *** > >> [Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDrive > >> r > >> .dir/all] > >> Error 2 > >> > >> make: *** [all] Error 2 > >> > >> > >> > >> My cmake setup looks like this: > >> > >> CC=/intel/bin/icc CXX=/intel/bin/icc cmake > >> -DCMAKE_CXX_COMPILER:FILEPATH=$CXX -DCMAKE_C_COMPILER:FILEPATH=$CC > >> -DModule_PerformanceBenchmarking:BOOL=ON .. > >> > >> > >> > >> Example generated CXX_FLAGS are from: > >> ./Modules/Core/ImageFunction/test/CMakeFiles/ITKImageFunctionTestDriv > >> e > >> r.dir/flags.make > >> > >> # compile CXX with /intel/bin/icc > >> > >> CXX_FLAGS = -w2 -wd1268 -wd981 -wd383 -wd1418 -wd1419 -wd2259 -wd1572 > >> -wd424 -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch > >> -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -Wno-deprecated > >> -Wno-invalid-offsetof -Woverloaded-virtual -O3 -DNDEBUG -fPIE > >> -I/src/ITK/Modules/Core/ImageAdaptors/include > >> -I/src/ITK/build_icc/Modules/ThirdParty/KWIML/src > >> -I/src/ITK/Modules/ThirdParty/KWIML/src > >> -I/src/ITK/build_icc/Modules/ThirdParty/KWSys/src > >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/v3p/netlib > >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/vcl > >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core > >> -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/v3p/netlib > >> -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/vcl > >> -I/src/ITK/build_icc/Modules/ThirdParty/VNL/src/vxl/core > >> -I/src/ITK/Modules/ThirdParty/VNLInstantiation/include > >> -I/src/ITK/build_icc/Modules/Core/Common > >> -I/src/ITK/Modules/Core/Common/include > >> -I/src/ITK/build_icc/Modules/ThirdParty/Netlib > >> -I/src/ITK/Modules/Numerics/Statistics/include > >> -I/src/ITK/Modules/Filtering/ImageFilterBase/include > >> -I/src/ITK/Modules/Core/Transform/include > >> -I/src/ITK/Modules/Core/ImageFunction/include > >> -I/src/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion > >> -I/src/ITK/build_icc/Modules/ThirdParty/DoubleConversion/src/double-c > >> o > >> nversion > >> -I/src/ITK/Modules/IO/BMP/include > >> -I/src/ITK/build_icc/Modules/ThirdParty/Expat/src/expat > >> -I/src/ITK/Modules/ThirdParty/Expat/src/expat > >> -I/src/ITK/build_icc/Modules/ThirdParty/ZLIB/src > >> -I/src/ITK/Modules/ThirdParty/ZLIB/src > >> -I/src/ITK/build_icc/Modules/ThirdParty/GDCM > >> -I/src/ITK/build_icc/Modules/ThirdParty/GDCM/src/gdcm/Source/Common > >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFil > >> e > >> Format > >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary > >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/Common > >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/InformationObjectD > >> e > >> finition > >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MessageExchangeDef > >> i > >> nition > >> -I/src/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEn > >> c odingDefinition -I/src/ITK/Modules/IO/GDCM/include > >> -I/src/ITK/Modules/IO/GIPL/include > >> -I/src/ITK/build_icc/Modules/IO/ImageBase > >> -I/src/ITK/Modules/IO/ImageBase/include > >> -I/src/ITK/Modules/IO/JPEG/include > >> -I/src/ITK/build_icc/Modules/ThirdParty/MetaIO/src/MetaIO/src > >> -I/src/ITK/Modules/ThirdParty/MetaIO/src/MetaIO/src > >> -I/src/ITK/Modules/IO/Meta/include > >> -I/src/ITK/Modules/IO/NIFTI/include > >> -I/src/ITK/Modules/IO/NRRD/include -I/src/ITK/Modules/IO/PNG/include > >> -I/src/ITK/Modules/IO/TIFF/include -I/src/ITK/Modules/IO/VTK/include > >> -I/src/ITK/Modules/Core/TestKernel/include > >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo > >> -I/src/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl > >> > >> > >> > >> Does anyone have a pointer to see where this error comes from? Thank > you. > >> > >> > >> > >> -Jon > >> > >> > _______________________________________________ > 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://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-developers > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _______________________________________________ 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://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-developers From yxp233 at postech.ac.kr Fri Apr 7 19:27:51 2017 From: yxp233 at postech.ac.kr (=?ks_c_5601-1987?B?WGlhb3BlbmcgWWFuZyi76r73sOa/tbD4x9Cw+ik=?=) Date: Fri, 7 Apr 2017 23:27:51 +0000 Subject: [ITK] [ITK-users] Speed Issue Message-ID: Hi, I found that ITK (such as fast-marching level-set, threshold-based level-set, and region growing) does not use all CPU cores during computation. My questions include: 1. Does ITK support full CPU cores computation? 2. Did anyone try to speed up ITK? If so, What is the best and fast way to speed up ITK? And how much faster than before can I achieve? I appreciate any help in advance. Thank you. Best regards, Xiaopeng _____________________________________ 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 From yxp233 at postech.ac.kr Fri Apr 7 19:27:51 2017 From: yxp233 at postech.ac.kr (=?ks_c_5601-1987?B?WGlhb3BlbmcgWWFuZyi76r73sOa/tbD4x9Cw+ik=?=) Date: Fri, 7 Apr 2017 23:27:51 +0000 Subject: [ITK] [ITK-dev] Speed Issue Message-ID: Hi, I found that ITK (such as fast-marching level-set, threshold-based level-set, and region growing) does not use all CPU cores during computation. My questions include: 1. Does ITK support full CPU cores computation? 2. Did anyone try to speed up ITK? If so, What is the best and fast way to speed up ITK? And how much faster than before can I achieve? I appreciate any help in advance. Thank you. Best regards, Xiaopeng _______________________________________________ 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://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-developers From syed.nauman at ge.com Fri Apr 7 17:29:58 2017 From: syed.nauman at ge.com (Nauman, Syed (GE Healthcare, consultant)) Date: Fri, 7 Apr 2017 21:29:58 +0000 Subject: [ITK] [ITK-users] Private Tags with itk 4.7 and gdcm Message-ID: <3890D9E960F85D4FA055392AAA00D285C36A5B@ALPURAPA25.e2k.ad.ge.com> Hello, I read some posts about private tags not working properly but couldn't find a way to load private tags. I'm using DicomSeriesReadPrintTags_8cxx And I used dicomIO->LoadPrivateTagsOn() and nameGenerator->SetLoadPrivateTags ( true ); But I get values for all private tags as (0043|10a8) = MlwtNVwyNSA= I can view using any tool to see the value as (0043|10b2) Private tag data LO: ['9548', '162.6', '338.391', '-2.870712'] I wonder shall I need to add this tag in dictionary as well? I tried playing around with the gdcm dictionary like; const gdcm::Global &g = gdcm::Global::GetInstance(); const gdcm::Dicts &dicts = g.GetDicts(); const gdcm::Dict & pubdict=dicts.GetPublicDict(); but it doesn't provide any example or any source about how to use private dictionaries or add any tag values in that? Can some one please help here with some source code about how to resolve this issue with itk 4.7 and gdcm 2.2 Thanks, -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Fri Apr 7 21:43:09 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Fri, 7 Apr 2017 21:43:09 -0400 Subject: [ITK] [ITK-users] Private Tags with itk 4.7 and gdcm In-Reply-To: <3890D9E960F85D4FA055392AAA00D285C36A5B@ALPURAPA25.e2k.ad.ge.com> References: <3890D9E960F85D4FA055392AAA00D285C36A5B@ALPURAPA25.e2k.ad.ge.com> Message-ID: Hi Syed, I think that you need to do base64-decoding. E.g. MlwtNVwyNSA= yields 2\-5\25 Regards, D?enan On Fri, Apr 7, 2017 at 5:29 PM, Nauman, Syed (GE Healthcare, consultant) < syed.nauman at ge.com> wrote: > Hello, > > I read some posts about private tags not working properly but couldn?t > find a way to load private tags. > > > > I?m using DicomSeriesReadPrintTags_8cxx > > > > And I used > > dicomIO->LoadPrivateTagsOn() > > > > and > > nameGenerator->SetLoadPrivateTags ( true ); > > > > But I get values for all private tags as > > > > (0043|10a8) = MlwtNVwyNSA= > > > > I can view using any tool to see the value as > > (0043|10b2) Private tag data LO: ['9548', '162.6', > '338.391', '-2.870712'] > > > > I wonder shall I need to add this tag in dictionary as well? > > I tried playing around with the gdcm dictionary like; > > const gdcm::Global &g = gdcm::Global::GetInstance(); > > const gdcm::Dicts &dicts = g.GetDicts(); > > const gdcm::Dict & pubdict=dicts.GetPublicDict(); > > > > but it doesn?t provide any example or any source about how to use private > dictionaries or add any tag values in that? > > Can some one please help here with some source code about how to resolve > this issue with itk 4.7 and gdcm 2.2 > > > > Thanks, > > > > > > > > > > > > > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matimontg at gmail.com Sat Apr 8 11:33:10 2017 From: matimontg at gmail.com (Matias) Date: Sat, 8 Apr 2017 08:33:10 -0700 (MST) Subject: [ITK] [ITK-users] Correct this stereotactic error in a Volume Message-ID: <1491665590917-38079.post@n7.nabble.com> Hi,I'm dealing with an image which was captured somewhat incorrectly and I'm trying to solve or correct the stereotactic frame snake figure so that it gets as a line.Here's the Volume I'm trying to rectify: Look at the "snake" figure in the stereotactic oblique stick. Is there any method in ITK to solve this? we did apply a resample (every 1mm) but did not work. We also rotated the volume using Euler3D and some precalculated angles (Gamma, Beta,Alfa) and still remained the same.I think is a matter of rotating every 10 slides or so which is where we see the stereotactic frame movement in the slides but not sure how to perform this. We thought of rotating each slide but that doesn't work since it has to rotate the volume. -- View this message in context: http://itk-users.7.n7.nabble.com/Correct-this-stereotactic-error-in-a-Volume-tp38079.html Sent from the ITK - Users mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Sat Apr 8 16:51:00 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Sat, 8 Apr 2017 16:51:00 -0400 Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: <1491482054290-38074.post@n7.nabble.com> References: <1491482054290-38074.post@n7.nabble.com> Message-ID: Hi Sidharta, your function to calculate interpolated Hounsfield values seems correct. Your problem of selecting oblique slice to resample can be reduced to finding a plane which passed through your first and last point, and as an arbitrary constraint passes through point [0,0,0]. If this point is collinear with your line then pick point [1,0,0], [0,1,0] or [0,0,1]. One of them will not be collinear. In order to resample your oblique slice, you need to figure out a transform matrix which transforms your first point to coordinates [0,0,0], your last point to coordinates e.g. [1000,0,0] and transforms the normal of your plane to be parallel with vector [0,0,1]. Then use resample filter, set your transform matrix and set as target image's region index [0,0,0] and size [1001,1,1]. Alternatively index [0,-10,0] and size [1001,21,1] if you want to have a real 2D slice to look at. Hope this helps, D?enan On Thu, Apr 6, 2017 at 8:34 AM, sidharta wrote: > Dear all, > > I am trying to extract density profile along a trajectory in CT. Using some > adjustments to contour-based segmentation and getting a mesh from the > binary > mask, I computed certain trajectories tangential to certain faces/vertices > of the mesh. > > Now, I have the coordinates of the target point and a tangent to the > target. > So, depending on the spacing, I extract all the points along the tangent > which are 5mm away from the target. I am using following code to generate > densities after I have got the physical coordinates along this line. > > void generateDensities(std::vector points, > InternalImageType::Pointer image){ > > InternalImageType::IndexType pixelIndex; > PointType point; > itk::ContinuousIndex pixel; > linearInterpolationContinuousIndexType::Pointer interpolate = > linearInterpolationContinuousIndexType::New(); > > interpolate->SetInputImage(image); > > std::vector HU_values; > std::vector HU_values_interpolate; > std::vector Pixel_indices; > std::vector> > Pixel_indices_interpolated; > // std::cout << "Generating with interpolation" << std::endl; > for (int i = 0; i < points.size(); i++) > { > Vector3d temp_point = points.at(i); > point[0] = temp_point[0]; > point[1] = temp_point[1]; > point[2] = temp_point[2]; > // std::cout << "Getting continuous index " << std::endl; > bool isInside = image->TransformPhysicalPointToContin > uousIndex(point, > pixel); > if (isInside) > { > InternalImageType::PixelType pixelValue = > interpolate->EvaluateAtContinuousIndex(pixel); > HU_values_interpolate.push_back(pixelValue); > Pixel_indices_interpolated.push_back(pixel); > } > else > std::cout << "Point " << point << " with index " > << pixel << "is outside" > << std::endl; > } > All_HU_values_interpolated.push_back(HU_values_interpolate); > All_pixel_indices_interpolated.push_back(Pixel_ > indices_interpolated); > HU_values_interpolate.clear(); > HU_values.clear(); > } > > Now, for verification that I am actually getting in fact the correct > values, > I would like to extract the oblique slice along this trajectory and I > figure > I have to use the Resample filter to "transform" the CT so that rotation > puts the resampled CT coordinate system parallel to the trajectory and the > origin translated to the start of the trajectory. Now, along the > trajectory, > with the set of collinear points (along the trajectory), I can get a lot of > planes (oblique slices essentially) which have the trajectory in them. So > to > get around this, I figure if I give another point which is non-collinear to > these points, I can specify the exact oblique slice I want. However, this > is > something I have to figure out for a lot of trajectories for the same CT > and > then correspondingly for others. Can someone tell me how can I achieve this > "automatically" for all trajectories/CTs? > PS. All CTs have the same spacing and origin. > Kindly also mention if you think the function for generating the densities > is correct or not? Eitherways I would like to validate. > > Thank you, > Sidharta > > > > > -- > View this message in context: http://itk-users.7.n7.nabble. > com/Extract-slice-from-ResampleFilter-tp38074.html > Sent from the ITK - 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matimontg at gmail.com Sat Apr 8 18:08:22 2017 From: matimontg at gmail.com (Matias) Date: Sat, 8 Apr 2017 15:08:22 -0700 (MST) Subject: [ITK] [ITK-users] Rotating image results in last slices being half empty Message-ID: <1491689302258-38081.post@n7.nabble.com> Hi,I'm rotating a volume (Using the Euler3DTransform) and the final set of slices are half black or empty.here's an example when rotating a volume of 10 slices:Am I missing something such as changing the origin or maybe computing the center incorrectly? (The center is passed as parameter from another program) And here's the code I'm using: typedef itk::ResampleImageFilter FilterType; FilterType::Pointer FiltroResample = FilterType::New(); FiltroResample->SetInput(reader->GetOutput()); typedef itk::LinearInterpolateImageFunction InterpolatorType; InterpolatorType::Pointer interpolator = InterpolatorType::New(); FiltroResample->SetInterpolator(interpolator); FiltroResample->SetOutputDirection(inputImage->GetDirection()); FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); ImageType::SizeType inputSize = inputImage->GetLargestPossibleRegion().GetSize(); FiltroResample->SetSize(inputSize); const ImageType::SpacingType& inputSpacing = inputImage->GetSpacing(); FiltroResample->SetOutputSpacing(inputSpacing); FiltroResample->SetDefaultPixelValue(-1000); typedef itk::Euler3DTransform< double > TransformType; //Transform TransformType::Pointer transform = TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z, origenX,origenY; gamma = atof(argv[2]); beta = atof(argv[3]); alfa = atof(argv[4]); centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = atof(argv[6]); centro_rotacion_Z = atof(argv[7]); origenX = atof(argv[8]); origenY = atof(argv[9]); transform->SetRotation(gamma, beta, alfa); double centro[3] = { centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z }; transform->SetCenter(centro); FiltroResample->SetTransform(transform); FiltroResample->Update(); -- View this message in context: http://itk-users.7.n7.nabble.com/Rotating-image-results-in-last-slices-being-half-empty-tp38081.html Sent from the ITK - Users mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From bakkari.abdelkhalek at hotmail.fr Sun Apr 9 16:00:06 2017 From: bakkari.abdelkhalek at hotmail.fr (Abdelkhalek Bakkari) Date: Sun, 9 Apr 2017 20:00:06 +0000 Subject: [ITK] [ITK-users] Maximum distance between points - Point Set - Message-ID: Dear insight-users, I would like to ask, if I could specify the Maximum distance between points after extracting the points using BinaryMaskToNarrowBandPointSetFilter. Thank you in advance. Kind regards, Abdelkhalek Bakkari Ph.D candidate in Computer Science Institute of Applied Computer Science Lodz University of Technology, Poland -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matt.mccormick at kitware.com Sun Apr 9 18:19:37 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Sun, 9 Apr 2017 18:19:37 -0400 Subject: [ITK] [ITK-users] Speed Issue In-Reply-To: References: Message-ID: Hi Xiaopeng, > I found that ITK (such as fast-marching level-set, threshold-based level-set, and region growing) does not use all CPU cores during computation. > > My questions include: > 1. Does ITK support full CPU cores computation? In general, most algorithm implementations are multi-threaded and intended to use all CPU cores. There may be some implementations that should be multi-threaded or there may be some implementations that could be improved in their thread utilization. > 2. Did anyone try to speed up ITK? If so, What is the best and fast way to speed up ITK? And how much faster than before can I achieve? There are ongoing efforts to improve performance - your participation is welcome. See: http://public.kitware.com/pipermail/insight-developers/2017-April/025151.html Thanks, Matt _____________________________________ 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 From matt.mccormick at kitware.com Sun Apr 9 18:19:37 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Sun, 9 Apr 2017 18:19:37 -0400 Subject: [ITK] [ITK-dev] [ITK-users] Speed Issue In-Reply-To: References: Message-ID: Hi Xiaopeng, > I found that ITK (such as fast-marching level-set, threshold-based level-set, and region growing) does not use all CPU cores during computation. > > My questions include: > 1. Does ITK support full CPU cores computation? In general, most algorithm implementations are multi-threaded and intended to use all CPU cores. There may be some implementations that should be multi-threaded or there may be some implementations that could be improved in their thread utilization. > 2. Did anyone try to speed up ITK? If so, What is the best and fast way to speed up ITK? And how much faster than before can I achieve? There are ongoing efforts to improve performance - your participation is welcome. See: http://public.kitware.com/pipermail/insight-developers/2017-April/025151.html Thanks, Matt _______________________________________________ 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://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-developers From sidharta.gupta93 at gmail.com Mon Apr 10 05:29:55 2017 From: sidharta.gupta93 at gmail.com (sidharta) Date: Mon, 10 Apr 2017 02:29:55 -0700 (MST) Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: References: <1491482054290-38074.post@n7.nabble.com> Message-ID: <1491816595489-38084.post@n7.nabble.com> Dear D?enan, Thank you for your reply. Actually, I found a third point which gives me the exact (informative) slice I am looking for. Should I resample the image twice, first rotate the image to the direction of the trajectory and move the origin to the start of the trajectory and second rotate the image to the angle between the trajectory and the third point? I will try what you said and get back to you. I am asking because I don't think resampling twice makes sense. Thank you for your time. Sidharta -- View this message in context: http://itk-users.7.n7.nabble.com/Extract-slice-from-ResampleFilter-tp38074p38084.html Sent from the ITK - 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 From blowekamp at mail.nih.gov Mon Apr 10 08:36:47 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Mon, 10 Apr 2017 12:36:47 +0000 Subject: [ITK] [ITK-users] Speed Issue In-Reply-To: References: Message-ID: <65848276-41CC-46D4-BAF3-F529A51C1FC9@mail.nih.gov> Hello, Regarding single threaded region growing, the nature of regions growing with a breadth first algorithm is inherently single threaded. However, the equivalent results can be obtained by doing a global threshold, followed by connect components analysis. Both of those algorithms are efficiently multi-threaded. Depending on the size of the image, shape of region, and other factors, one approach may be more efficient than the other. HTH, Brad > On Apr 7, 2017, at 7:27 PM, Xiaopeng Yang(???????) wrote: > > Hi, > > I found that ITK (such as fast-marching level-set, threshold-based level-set, and region growing) does not use all CPU cores during computation. > > My questions include: > 1. Does ITK support full CPU cores computation? > 2. Did anyone try to speed up ITK? If so, What is the best and fast way to speed up ITK? And how much faster than before can I achieve? > > I appreciate any help in advance. Thank you. > > Best regards, > Xiaopeng > _____________________________________ > 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 _____________________________________ 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 From blowekamp at mail.nih.gov Mon Apr 10 08:36:47 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Mon, 10 Apr 2017 12:36:47 +0000 Subject: [ITK] [ITK-dev] [ITK-users] Speed Issue In-Reply-To: References: Message-ID: <65848276-41CC-46D4-BAF3-F529A51C1FC9@mail.nih.gov> Hello, Regarding single threaded region growing, the nature of regions growing with a breadth first algorithm is inherently single threaded. However, the equivalent results can be obtained by doing a global threshold, followed by connect components analysis. Both of those algorithms are efficiently multi-threaded. Depending on the size of the image, shape of region, and other factors, one approach may be more efficient than the other. HTH, Brad > On Apr 7, 2017, at 7:27 PM, Xiaopeng Yang(???????) wrote: > > Hi, > > I found that ITK (such as fast-marching level-set, threshold-based level-set, and region growing) does not use all CPU cores during computation. > > My questions include: > 1. Does ITK support full CPU cores computation? > 2. Did anyone try to speed up ITK? If so, What is the best and fast way to speed up ITK? And how much faster than before can I achieve? > > I appreciate any help in advance. Thank you. > > Best regards, > Xiaopeng > _____________________________________ > 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 _______________________________________________ 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://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-developers From dzenanz at gmail.com Mon Apr 10 09:24:50 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Mon, 10 Apr 2017 09:24:50 -0400 Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: <1491816595489-38084.post@n7.nabble.com> References: <1491482054290-38074.post@n7.nabble.com> <1491816595489-38084.post@n7.nabble.com> Message-ID: ?Hi Sidharta, you definitely should not resample twice. All you need is to compound the two transforms (multiply their matrices)?. And apply a single resampling. But for debugging purposes, you could also display the resampled output after only the first transform. Regards, D?enan On Mon, Apr 10, 2017 at 5:29 AM, sidharta wrote: > Dear D?enan, > > Thank you for your reply. Actually, I found a third point which gives me > the > exact (informative) slice I am looking for. Should I resample the image > twice, first rotate the image to the direction of the trajectory and move > the origin to the start of the trajectory and second rotate the image to > the > angle between the trajectory and the third point? I will try what you said > and get back to you. I am asking because I don't think resampling twice > makes sense. > > Thank you for your time. > Sidharta > > > > -- > View this message in context: http://itk-users.7.n7.nabble. > com/Extract-slice-from-ResampleFilter-tp38074p38084.html > Sent from the ITK - 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 > _______________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From aharr8 at uwo.ca Tue Apr 11 08:36:13 2017 From: aharr8 at uwo.ca (Andrew Harris) Date: Tue, 11 Apr 2017 08:36:13 -0400 Subject: [ITK] [ITK-users] Normalized Cross Correlation returns perfect alignment with images not even overlapping In-Reply-To: References: Message-ID: In the image mask, the parts we want to include in the calculation are bright and the parts that we want to exclude are dark, is that the opposite of what it should be? -- AH ----------------------------------------------------------------------------------------------- *This email and any attachments thereto may contain private, confidential, and privileged materials for the sole use of the intended recipient. Any reviewing, copying, or distribution of this email (or any attachments thereto) by other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently destroy this email and any attachments thereto.* On Thu, Mar 30, 2017 at 7:25 PM, D?enan Zuki? wrote: > Hi Andrew, > > your masks might be inverted. If NCC gets all black pixels in both images, > the correlation will be perfect. > > Regards, > D?enan > > On Thu, Mar 30, 2017 at 2:13 PM, Andrew Harris wrote: > >> Hi, I'm hoping someone can guide me toward an explanation of this. I run >> my pipeline on various ultrasound image sets and get an NCC between 0.65 >> and 0.8 for good alignments, but on some sets the NCC returns 1.0 when the >> images aren't even overlapping. I have the black areas of the image masked >> out, and have even tried cranking up the threshold to be sure the darker >> areas aren't being included to no avail. Any thoughts? >> >> -- >> >> AH >> >> >> ------------------------------------------------------------ >> ----------------------------------- >> >> *This email and any attachments thereto may contain private, >> confidential, and privileged materials for the sole use of the intended >> recipient. Any reviewing, copying, or distribution of this email (or any >> attachments thereto) by other than the intended recipient is strictly >> prohibited. If you are not the intended recipient, please contact the >> sender immediately and permanently destroy this email and any attachments >> thereto.* >> >> _____________________________________ >> 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 >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From francois.budin at kitware.com Tue Apr 11 09:00:16 2017 From: francois.budin at kitware.com (Francois Budin) Date: Tue, 11 Apr 2017 09:00:16 -0400 Subject: [ITK] [ITK-users] Normalized Cross Correlation returns perfect alignment with images not even overlapping In-Reply-To: References: Message-ID: Hello Andrew, Did you try to initialize the registration with [1] for example? If the images do not overlap at all at the beginning of the registration, the algorithm might only do what D?enan said, match black pixels. Initializing the transform should help. Hope this helps, Francois [1] https://itk.org/Doxygen/html/classitk_1_1CenteredTransformInitializer.html On Tue, Apr 11, 2017 at 8:36 AM, Andrew Harris wrote: > In the image mask, the parts we want to include in the calculation are > bright and the parts that we want to exclude are dark, is that the opposite > of what it should be? > > -- > > AH > > > ------------------------------------------------------------ > ----------------------------------- > > *This email and any attachments thereto may contain private, > confidential, and privileged materials for the sole use of the intended > recipient. Any reviewing, copying, or distribution of this email (or any > attachments thereto) by other than the intended recipient is strictly > prohibited. If you are not the intended recipient, please contact the > sender immediately and permanently destroy this email and any attachments > thereto.* > > On Thu, Mar 30, 2017 at 7:25 PM, D?enan Zuki? wrote: > >> Hi Andrew, >> >> your masks might be inverted. If NCC gets all black pixels in both >> images, the correlation will be perfect. >> >> Regards, >> D?enan >> >> On Thu, Mar 30, 2017 at 2:13 PM, Andrew Harris wrote: >> >>> Hi, I'm hoping someone can guide me toward an explanation of this. I >>> run my pipeline on various ultrasound image sets and get an NCC between >>> 0.65 and 0.8 for good alignments, but on some sets the NCC returns 1.0 when >>> the images aren't even overlapping. I have the black areas of the image >>> masked out, and have even tried cranking up the threshold to be sure the >>> darker areas aren't being included to no avail. Any thoughts? >>> >>> -- >>> >>> AH >>> >>> >>> ------------------------------------------------------------ >>> ----------------------------------- >>> >>> *This email and any attachments thereto may contain private, >>> confidential, and privileged materials for the sole use of the intended >>> recipient. Any reviewing, copying, or distribution of this email (or any >>> attachments thereto) by other than the intended recipient is strictly >>> prohibited. If you are not the intended recipient, please contact the >>> sender immediately and permanently destroy this email and any attachments >>> thereto.* >>> >>> _____________________________________ >>> 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 >>> >>> >> > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From niels-xtk at xs4all.nl Tue Apr 11 09:11:18 2017 From: niels-xtk at xs4all.nl (Niels Dekker) Date: Tue, 11 Apr 2017 15:11:18 +0200 Subject: [ITK] [ITK-dev] Static link "error LNK2005: png_get_uint_31 already defined in png.lib", missing #define in itk_png_mangle.h? Message-ID: <21acf28759ecc26926c0ac9b01080102@xs4all.nl> When trying build our project, which links statically to both ITK and the Niftyreg library, my colleague Floris Berendsen and I encountered the following link error: >itkpng-4.10.lib(pngrutil.obj) : error LNK2005: png_get_uint_31 already defined in png.lib(pngrutil.obj) [...\SuperElastix-build\Testing\Unit\selxAnyFileIOTest.vcxproj] >...\SuperElastix-build\bin\Debug\selxAnyFileIOTest.exe : fatal error LNK1169: one or more multiply defined symbols found [...\SuperElastix-build\Testing\Unit\selxAnyFileIOTest.vcxproj] It appears that ITK and Niftyreg link to different versions of libpng. Fortunately, ITK has done name mangling for most of the libpng API functions, to avoid such linking errors, as we can see at Modules/ThirdParty/PNG/src/itkpng/itk_png_mangle.h Now it appears that the function "png_get_uint_31" is also exported by libpng, but that function is not mangled by ITK! We could locally fix our link error by adding an extra #define to "itk_png_mangle.h": #define png_get_uint_31 itk_png_get_uint_31 Do you guys agree that that would be an appropriate fix? Could such a fix be added to the ITK code base? Kind regards, Niels PS Our project, SuperElastix, can be found at https://github.com/SuperElastix/SuperElastix (We tried to build the SuperBuild from the development branch.) The Nifty Reg library is from https://cmiclab.cs.ucl.ac.uk/mmodat/niftyreg -- Niels Dekker Scientific programmer LKEB, Leiden University Medical Center, Netherlands _______________________________________________ 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://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-developers From matt.mccormick at kitware.com Tue Apr 11 09:28:49 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Tue, 11 Apr 2017 09:28:49 -0400 Subject: [ITK] [ITK-dev] Static link "error LNK2005: png_get_uint_31 already defined in png.lib", missing #define in itk_png_mangle.h? In-Reply-To: <21acf28759ecc26926c0ac9b01080102@xs4all.nl> References: <21acf28759ecc26926c0ac9b01080102@xs4all.nl> Message-ID: Hi Niels, Thanks for discussing the issue. Yes, the addition is a good improvement that should address the issue. Could you please submit a patch?: https://itk.org/Wiki/ITK/Git/Develop Thanks, Matt On Tue, Apr 11, 2017 at 9:11 AM, Niels Dekker wrote: > When trying build our project, which links statically to both ITK and the > Niftyreg library, my colleague Floris Berendsen and I encountered the > following link error: > > >itkpng-4.10.lib(pngrutil.obj) : error LNK2005: png_get_uint_31 already > defined in png.lib(pngrutil.obj) > [...\SuperElastix-build\Testing\Unit\selxAnyFileIOTest.vcxproj] > >...\SuperElastix-build\bin\Debug\selxAnyFileIOTest.exe : fatal error > LNK1169: one or more multiply defined symbols found > [...\SuperElastix-build\Testing\Unit\selxAnyFileIOTest.vcxproj] > > It appears that ITK and Niftyreg link to different versions of libpng. > Fortunately, ITK has done name mangling for most of the libpng API > functions, to avoid such linking errors, as we can see at > Modules/ThirdParty/PNG/src/itkpng/itk_png_mangle.h Now it appears that the > function "png_get_uint_31" is also exported by libpng, but that function is > not mangled by ITK! We could locally fix our link error by adding an extra > #define to "itk_png_mangle.h": > > #define png_get_uint_31 itk_png_get_uint_31 > > Do you guys agree that that would be an appropriate fix? Could such a fix be > added to the ITK code base? > > Kind regards, Niels > > PS Our project, SuperElastix, can be found at > https://github.com/SuperElastix/SuperElastix (We tried to build the > SuperBuild from the development branch.) The Nifty Reg library is from > https://cmiclab.cs.ucl.ac.uk/mmodat/niftyreg > > -- > Niels Dekker > Scientific programmer > LKEB, Leiden University Medical Center, Netherlands > _______________________________________________ > 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://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-developers _______________________________________________ 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://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-developers From francois.budin at kitware.com Tue Apr 11 09:35:47 2017 From: francois.budin at kitware.com (Francois Budin) Date: Tue, 11 Apr 2017 09:35:47 -0400 Subject: [ITK] [ITK-dev] Static link "error LNK2005: png_get_uint_31 already defined in png.lib", missing #define in itk_png_mangle.h? In-Reply-To: <21acf28759ecc26926c0ac9b01080102@xs4all.nl> References: <21acf28759ecc26926c0ac9b01080102@xs4all.nl> Message-ID: Hello Niels, Thank you for reporting this issue. I looked into itk_png_mangle.h and indeed it looks like the function 'png_get_uint_31' should be renamed and is not. Using this command [1], updated to your ITK version, you should be able to see the the functions that are missing and need to be added to itk_png_mangle.h . It would be great if you commit submit a patch to ITK to correct this issue. You can find step by step instructions about how to contribute here [2]. Feel free to reach out if you have any problem during this process. Thank you so much for your help, Francois [1] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/ThirdParty/PNG/src/itkpng/itk_png_mangle.h#L13-L15 [2] https://itk.org/Wiki/ITK/Git/Develop On Tue, Apr 11, 2017 at 9:11 AM, Niels Dekker wrote: > When trying build our project, which links statically to both ITK and the > Niftyreg library, my colleague Floris Berendsen and I encountered the > following link error: > > >itkpng-4.10.lib(pngrutil.obj) : error LNK2005: png_get_uint_31 already > defined in png.lib(pngrutil.obj) [...\SuperElastix-build\Testin > g\Unit\selxAnyFileIOTest.vcxproj] > >...\SuperElastix-build\bin\Debug\selxAnyFileIOTest.exe : fatal error > LNK1169: one or more multiply defined symbols found > [...\SuperElastix-build\Testing\Unit\selxAnyFileIOTest.vcxproj] > > It appears that ITK and Niftyreg link to different versions of libpng. > Fortunately, ITK has done name mangling for most of the libpng API > functions, to avoid such linking errors, as we can see at > Modules/ThirdParty/PNG/src/itkpng/itk_png_mangle.h Now it appears that > the function "png_get_uint_31" is also exported by libpng, but that > function is not mangled by ITK! We could locally fix our link error by > adding an extra #define to "itk_png_mangle.h": > > #define png_get_uint_31 itk_png_get_uint_31 > > Do you guys agree that that would be an appropriate fix? Could such a fix > be added to the ITK code base? > > Kind regards, Niels > > PS Our project, SuperElastix, can be found at > https://github.com/SuperElastix/SuperElastix (We tried to build the > SuperBuild from the development branch.) The Nifty Reg library is from > https://cmiclab.cs.ucl.ac.uk/mmodat/niftyreg > > -- > Niels Dekker > Scientific programmer > LKEB, Leiden University Medical Center, Netherlands > _______________________________________________ > 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://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-developers > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _______________________________________________ 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://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-developers From matt.mccormick at kitware.com Tue Apr 11 10:29:23 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Tue, 11 Apr 2017 10:29:23 -0400 Subject: [ITK] [ITK-users] beautiful stuff In-Reply-To: <1916655864.20170410211908@libero.it> References: <1916655864.20170410211908@libero.it> Message-ID: This message has been identified as spam and the account suspended. On Mon, Apr 10, 2017 at 2:19 PM, zilu via Insight-users wrote: > Yo! > > Look at that beautiful stuff, isn't it amazing? Take a look here http://vossignoria.net/enemy.php?4547 > > Take care, Valentina Scubla > > > > > > -- > View this message in context: http://itk-insight-users.2283740.n2.nabble.com/beautiful-stuff-tp7589797.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 _____________________________________ 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 From niels-xtk at xs4all.nl Tue Apr 11 11:49:01 2017 From: niels-xtk at xs4all.nl (Niels Dekker) Date: Tue, 11 Apr 2017 17:49:01 +0200 Subject: [ITK] [ITK-dev] Static link "error LNK2005: png_get_uint_31 already defined in png.lib", missing #define in itk_png_mangle.h? In-Reply-To: References: <21acf28759ecc26926c0ac9b01080102@xs4all.nl> Message-ID: Thank you for your supportive replies, Matt and Francois. My colleague Floris Berendsen and I will try to submit a patch for this issue later this week. Kind regards, Niels Francois Budin wrote op 2017-04-11 15:35: > Hello Niels, > > Thank you for reporting this issue. I looked into itk_png_mangle.h and > indeed it looks like the function 'png_get_uint_31' should be renamed > and is not. > Using this command [1], updated to your ITK version, you should be > able to see the the functions that are missing and need to be added to > itk_png_mangle.h . > It would be great if you commit submit a patch to ITK to correct this > issue. > You can find step by step instructions about how to contribute here > [2]. Feel free to reach out if you have any problem during this > process. > > Thank you so much for your help, > Francois > > [1] > https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/ThirdParty/PNG/src/itkpng/itk_png_mangle.h#L13-L15 > [2] https://itk.org/Wiki/ITK/Git/Develop > > On Tue, Apr 11, 2017 at 9:11 AM, Niels Dekker wrote: > >> When trying build our project, which links statically to both ITK >> and the Niftyreg library, my colleague Floris Berendsen and I >> encountered the following link error: >> >>> itkpng-4.10.lib(pngrutil.obj) : error LNK2005: png_get_uint_31 >> already defined in png.lib(pngrutil.obj) >> [...\SuperElastix-build\Testing\Unit\selxAnyFileIOTest.vcxproj] >>> ...\SuperElastix-build\bin\Debug\selxAnyFileIOTest.exe : fatal >> error LNK1169: one or more multiply defined symbols found >> [...\SuperElastix-build\Testing\Unit\selxAnyFileIOTest.vcxproj] >> >> It appears that ITK and Niftyreg link to different versions of >> libpng. Fortunately, ITK has done name mangling for most of the >> libpng API functions, to avoid such linking errors, as we can see at >> Modules/ThirdParty/PNG/src/itkpng/itk_png_mangle.h Now it appears >> that the function "png_get_uint_31" is also exported by libpng, but >> that function is not mangled by ITK! We could locally fix our link >> error by adding an extra #define to "itk_png_mangle.h": >> >> #define png_get_uint_31 itk_png_get_uint_31 >> >> Do you guys agree that that would be an appropriate fix? Could such >> a fix be added to the ITK code base? >> >> Kind regards, Niels >> >> PS Our project, SuperElastix, can be found at >> https://github.com/SuperElastix/SuperElastix (We tried to build >> the SuperBuild from the development branch.) The Nifty Reg library >> is from https://cmiclab.cs.ucl.ac.uk/mmodat/niftyreg -- Niels Dekker Scientific programmer LKEB, Leiden University Medical Center, Netherlands _______________________________________________ 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://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-developers From francois.budin at kitware.com Tue Apr 11 11:53:25 2017 From: francois.budin at kitware.com (Francois Budin) Date: Tue, 11 Apr 2017 11:53:25 -0400 Subject: [ITK] [ITK-dev] Static link "error LNK2005: png_get_uint_31 already defined in png.lib", missing #define in itk_png_mangle.h? In-Reply-To: References: <21acf28759ecc26926c0ac9b01080102@xs4all.nl> Message-ID: Thanks Niels. Let us know if you are running into any problem during that process. Francois On Tue, Apr 11, 2017 at 11:49 AM, Niels Dekker wrote: > Thank you for your supportive replies, Matt and Francois. My colleague > Floris Berendsen and I will try to submit a patch for this issue later this > week. > > Kind regards, Niels > > Francois Budin wrote op 2017-04-11 15:35: > >> Hello Niels, >> >> Thank you for reporting this issue. I looked into itk_png_mangle.h and >> indeed it looks like the function 'png_get_uint_31' should be renamed >> and is not. >> Using this command [1], updated to your ITK version, you should be >> able to see the the functions that are missing and need to be added to >> itk_png_mangle.h . >> It would be great if you commit submit a patch to ITK to correct this >> issue. >> You can find step by step instructions about how to contribute here >> [2]. Feel free to reach out if you have any problem during this >> process. >> >> Thank you so much for your help, >> Francois >> >> [1] >> https://github.com/InsightSoftwareConsortium/ITK/blob/ >> master/Modules/ThirdParty/PNG/src/itkpng/itk_png_mangle.h#L13-L15 >> [2] https://itk.org/Wiki/ITK/Git/Develop >> >> On Tue, Apr 11, 2017 at 9:11 AM, Niels Dekker wrote: >> >> When trying build our project, which links statically to both ITK >>> and the Niftyreg library, my colleague Floris Berendsen and I >>> encountered the following link error: >>> >>> itkpng-4.10.lib(pngrutil.obj) : error LNK2005: png_get_uint_31 >>>> >>> already defined in png.lib(pngrutil.obj) >>> [...\SuperElastix-build\Testing\Unit\selxAnyFileIOTest.vcxproj] >>> >>>> ...\SuperElastix-build\bin\Debug\selxAnyFileIOTest.exe : fatal >>>> >>> error LNK1169: one or more multiply defined symbols found >>> [...\SuperElastix-build\Testing\Unit\selxAnyFileIOTest.vcxproj] >>> >>> It appears that ITK and Niftyreg link to different versions of >>> libpng. Fortunately, ITK has done name mangling for most of the >>> libpng API functions, to avoid such linking errors, as we can see at >>> Modules/ThirdParty/PNG/src/itkpng/itk_png_mangle.h Now it appears >>> that the function "png_get_uint_31" is also exported by libpng, but >>> that function is not mangled by ITK! We could locally fix our link >>> error by adding an extra #define to "itk_png_mangle.h": >>> >>> #define png_get_uint_31 itk_png_get_uint_31 >>> >>> Do you guys agree that that would be an appropriate fix? Could such >>> a fix be added to the ITK code base? >>> >>> Kind regards, Niels >>> >>> PS Our project, SuperElastix, can be found at >>> https://github.com/SuperElastix/SuperElastix (We tried to build >>> the SuperBuild from the development branch.) The Nifty Reg library >>> is from https://cmiclab.cs.ucl.ac.uk/mmodat/niftyreg >>> >> > -- > Niels Dekker > Scientific programmer > LKEB, Leiden University Medical Center, Netherlands > _______________________________________________ > 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://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-developers > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _______________________________________________ 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://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-developers From sidharta.gupta93 at gmail.com Tue Apr 11 12:00:13 2017 From: sidharta.gupta93 at gmail.com (sidharta) Date: Tue, 11 Apr 2017 09:00:13 -0700 (MST) Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: References: <1491482054290-38074.post@n7.nabble.com> <1491816595489-38084.post@n7.nabble.com> Message-ID: <1491926413097-38091.post@n7.nabble.com> Hey D?enan, So, I kind of got the equation of the plane and the normal to the plane where all the three non-collinear points lie. Then, I got the angle between this normal and the z-axis of the image. I resample the image by rotating in 3D about the z-axis. How do I extract the exact slice from the resampled image? Is it actually required to resample the 3D Dicom, can I not resample a 2D image (just for optimization purposes)? I read the documentation (ITKSoftwareGuide) which shows one example for 3D resampling, however not how to save a particular slice. Kindly correct me if I am wrong. Thank you for your time. Best Regards, Sidharta -- View this message in context: http://itk-users.7.n7.nabble.com/Extract-slice-from-ResampleFilter-tp38074p38091.html Sent from the ITK - 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 From aharr8 at uwo.ca Tue Apr 11 14:02:49 2017 From: aharr8 at uwo.ca (Andrew Harris) Date: Tue, 11 Apr 2017 14:02:49 -0400 Subject: [ITK] [ITK-users] Normalized Cross Correlation returns perfect alignment with images not even overlapping In-Reply-To: References: Message-ID: Hello Francois and D?enan, Because of the way the images were captured, there is a known common point of overlap, so we set the centre to that point in the expectation that the transform would rotate and translate about that point when the registration is run. Have I misunderstood the design or is that what should be happening? -- AH ----------------------------------------------------------------------------------------------- *This email and any attachments thereto may contain private, confidential, and privileged materials for the sole use of the intended recipient. Any reviewing, copying, or distribution of this email (or any attachments thereto) by other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently destroy this email and any attachments thereto.* On Tue, Apr 11, 2017 at 9:00 AM, Francois Budin wrote: > Hello Andrew, > > Did you try to initialize the registration with [1] for example? > If the images do not overlap at all at the beginning of the registration, > the algorithm might only do what D?enan said, match black pixels. > Initializing the transform should help. > > Hope this helps, > Francois > > [1] https://itk.org/Doxygen/html/classitk_1_1CenteredTransformInitializer. > html > > On Tue, Apr 11, 2017 at 8:36 AM, Andrew Harris wrote: > >> In the image mask, the parts we want to include in the calculation are >> bright and the parts that we want to exclude are dark, is that the opposite >> of what it should be? >> >> -- >> >> AH >> >> >> ------------------------------------------------------------ >> ----------------------------------- >> >> *This email and any attachments thereto may contain private, >> confidential, and privileged materials for the sole use of the intended >> recipient. Any reviewing, copying, or distribution of this email (or any >> attachments thereto) by other than the intended recipient is strictly >> prohibited. If you are not the intended recipient, please contact the >> sender immediately and permanently destroy this email and any attachments >> thereto.* >> >> On Thu, Mar 30, 2017 at 7:25 PM, D?enan Zuki? wrote: >> >>> Hi Andrew, >>> >>> your masks might be inverted. If NCC gets all black pixels in both >>> images, the correlation will be perfect. >>> >>> Regards, >>> D?enan >>> >>> On Thu, Mar 30, 2017 at 2:13 PM, Andrew Harris wrote: >>> >>>> Hi, I'm hoping someone can guide me toward an explanation of this. I >>>> run my pipeline on various ultrasound image sets and get an NCC between >>>> 0.65 and 0.8 for good alignments, but on some sets the NCC returns 1.0 when >>>> the images aren't even overlapping. I have the black areas of the image >>>> masked out, and have even tried cranking up the threshold to be sure the >>>> darker areas aren't being included to no avail. Any thoughts? >>>> >>>> -- >>>> >>>> AH >>>> >>>> >>>> ------------------------------------------------------------ >>>> ----------------------------------- >>>> >>>> *This email and any attachments thereto may contain private, >>>> confidential, and privileged materials for the sole use of the intended >>>> recipient. Any reviewing, copying, or distribution of this email (or any >>>> attachments thereto) by other than the intended recipient is strictly >>>> prohibited. If you are not the intended recipient, please contact the >>>> sender immediately and permanently destroy this email and any attachments >>>> thereto.* >>>> >>>> _____________________________________ >>>> 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 >>>> >>>> >>> >> >> _____________________________________ >> 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 >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Tue Apr 11 14:03:19 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Tue, 11 Apr 2017 14:03:19 -0400 Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: <1491926413097-38091.post@n7.nabble.com> References: <1491482054290-38074.post@n7.nabble.com> <1491816595489-38084.post@n7.nabble.com> <1491926413097-38091.post@n7.nabble.com> Message-ID: Hi Sidartha, you can use extract filter to extract a single slice from a 3D image. Take a look at the examples liked from the documentation page. Regards, D?enan On Tue, Apr 11, 2017 at 12:00 PM, sidharta wrote: > Hey D?enan, > > So, I kind of got the equation of the plane and the normal to the plane > where all the three non-collinear points lie. Then, I got the angle between > this normal and the z-axis of the image. I resample the image by rotating > in > 3D about the z-axis. How do I extract the exact slice from the resampled > image? Is it actually required to resample the 3D Dicom, can I not resample > a 2D image (just for optimization purposes)? I read the documentation > (ITKSoftwareGuide) which shows one example for 3D resampling, however not > how to save a particular slice. Kindly correct me if I am wrong. > > > Thank you for your time. > Best Regards, > Sidharta > > > > -- > View this message in context: http://itk-users.7.n7.nabble. > com/Extract-slice-from-ResampleFilter-tp38074p38091.html > Sent from the ITK - 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Tue Apr 11 14:07:26 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Tue, 11 Apr 2017 14:07:26 -0400 Subject: [ITK] [ITK-users] Normalized Cross Correlation returns perfect alignment with images not even overlapping In-Reply-To: References: Message-ID: Hi Andrew, it is good to use such additional constraints when possible. But you also have to initialize the transform somehow, otherwise it might get auto-initialized to all modifiable parameters being equal to zero. That is usually a bad initial transform - hence Francois' suggestion. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Tue, Apr 11, 2017 at 2:02 PM, Andrew Harris wrote: > Hello Francois and D?enan, > > Because of the way the images were captured, there is a known common point > of overlap, so we set the centre to that point in the expectation that the > transform would rotate and translate about that point when the registration > is run. Have I misunderstood the design or is that what should be > happening? > > -- > > AH > > > ------------------------------------------------------------ > ----------------------------------- > > *This email and any attachments thereto may contain private, > confidential, and privileged materials for the sole use of the intended > recipient. Any reviewing, copying, or distribution of this email (or any > attachments thereto) by other than the intended recipient is strictly > prohibited. If you are not the intended recipient, please contact the > sender immediately and permanently destroy this email and any attachments > thereto.* > > On Tue, Apr 11, 2017 at 9:00 AM, Francois Budin < > francois.budin at kitware.com> wrote: > >> Hello Andrew, >> >> Did you try to initialize the registration with [1] for example? >> If the images do not overlap at all at the beginning of the registration, >> the algorithm might only do what D?enan said, match black pixels. >> Initializing the transform should help. >> >> Hope this helps, >> Francois >> >> [1] https://itk.org/Doxygen/html/classitk_1_1CenteredTransformIn >> itializer.html >> >> On Tue, Apr 11, 2017 at 8:36 AM, Andrew Harris wrote: >> >>> In the image mask, the parts we want to include in the calculation are >>> bright and the parts that we want to exclude are dark, is that the opposite >>> of what it should be? >>> >>> -- >>> >>> AH >>> >>> >>> ------------------------------------------------------------ >>> ----------------------------------- >>> >>> *This email and any attachments thereto may contain private, >>> confidential, and privileged materials for the sole use of the intended >>> recipient. Any reviewing, copying, or distribution of this email (or any >>> attachments thereto) by other than the intended recipient is strictly >>> prohibited. If you are not the intended recipient, please contact the >>> sender immediately and permanently destroy this email and any attachments >>> thereto.* >>> >>> On Thu, Mar 30, 2017 at 7:25 PM, D?enan Zuki? wrote: >>> >>>> Hi Andrew, >>>> >>>> your masks might be inverted. If NCC gets all black pixels in both >>>> images, the correlation will be perfect. >>>> >>>> Regards, >>>> D?enan >>>> >>>> On Thu, Mar 30, 2017 at 2:13 PM, Andrew Harris wrote: >>>> >>>>> Hi, I'm hoping someone can guide me toward an explanation of this. I >>>>> run my pipeline on various ultrasound image sets and get an NCC between >>>>> 0.65 and 0.8 for good alignments, but on some sets the NCC returns 1.0 when >>>>> the images aren't even overlapping. I have the black areas of the image >>>>> masked out, and have even tried cranking up the threshold to be sure the >>>>> darker areas aren't being included to no avail. Any thoughts? >>>>> >>>>> -- >>>>> >>>>> AH >>>>> >>>>> >>>>> ------------------------------------------------------------ >>>>> ----------------------------------- >>>>> >>>>> *This email and any attachments thereto may contain private, >>>>> confidential, and privileged materials for the sole use of the intended >>>>> recipient. Any reviewing, copying, or distribution of this email (or any >>>>> attachments thereto) by other than the intended recipient is strictly >>>>> prohibited. If you are not the intended recipient, please contact the >>>>> sender immediately and permanently destroy this email and any attachments >>>>> thereto.* >>>>> >>>>> _____________________________________ >>>>> 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 >>>>> >>>>> >>>> >>> >>> _____________________________________ >>> 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 >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From francois.budin at kitware.com Tue Apr 11 14:14:01 2017 From: francois.budin at kitware.com (Francois Budin) Date: Tue, 11 Apr 2017 18:14:01 +0000 Subject: [ITK] [ITK-users] Normalized Cross Correlation returns perfect alignment with images not even overlapping In-Reply-To: References: Message-ID: Hello Andrew, Another thing you can look at is if your transform parameters ratios are set to reasonable values. You typically have a ratio you can set between rotation, translation, scaling. If these are not set to appropriate values, the final transform could be wrong. In your case, it sounds like you are already performing the translation as an initialization. Maybe you can modify your parameters so that it performs mostly a rotation. Hope this helps, Fran?ois On Tue, Apr 11, 2017, 14:07 D?enan Zuki? wrote: > Hi Andrew, > > it is good to use such additional constraints when possible. But you also > have to initialize the transform somehow, otherwise it might get > auto-initialized to all modifiable parameters being equal to zero. That is > usually a bad initial transform - hence Francois' suggestion. > > Regards, > D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) > > On Tue, Apr 11, 2017 at 2:02 PM, Andrew Harris wrote: > > Hello Francois and D?enan, > > Because of the way the images were captured, there is a known common point > of overlap, so we set the centre to that point in the expectation that the > transform would rotate and translate about that point when the registration > is run. Have I misunderstood the design or is that what should be > happening? > > -- > > AH > > > > ----------------------------------------------------------------------------------------------- > > *This email and any attachments thereto may contain private, > confidential, and privileged materials for the sole use of the intended > recipient. Any reviewing, copying, or distribution of this email (or any > attachments thereto) by other than the intended recipient is strictly > prohibited. If you are not the intended recipient, please contact the > sender immediately and permanently destroy this email and any attachments > thereto.* > > On Tue, Apr 11, 2017 at 9:00 AM, Francois Budin < > francois.budin at kitware.com> wrote: > > Hello Andrew, > > Did you try to initialize the registration with [1] for example? > If the images do not overlap at all at the beginning of the registration, > the algorithm might only do what D?enan said, match black pixels. > Initializing the transform should help. > > Hope this helps, > Francois > > [1] > https://itk.org/Doxygen/html/classitk_1_1CenteredTransformInitializer.html > > On Tue, Apr 11, 2017 at 8:36 AM, Andrew Harris wrote: > > In the image mask, the parts we want to include in the calculation are > bright and the parts that we want to exclude are dark, is that the opposite > of what it should be? > > -- > > AH > > > > ----------------------------------------------------------------------------------------------- > > *This email and any attachments thereto may contain private, > confidential, and privileged materials for the sole use of the intended > recipient. Any reviewing, copying, or distribution of this email (or any > attachments thereto) by other than the intended recipient is strictly > prohibited. If you are not the intended recipient, please contact the > sender immediately and permanently destroy this email and any attachments > thereto.* > > On Thu, Mar 30, 2017 at 7:25 PM, D?enan Zuki? wrote: > > Hi Andrew, > > your masks might be inverted. If NCC gets all black pixels in both images, > the correlation will be perfect. > > Regards, > D?enan > > On Thu, Mar 30, 2017 at 2:13 PM, Andrew Harris wrote: > > Hi, I'm hoping someone can guide me toward an explanation of this. I run > my pipeline on various ultrasound image sets and get an NCC between 0.65 > and 0.8 for good alignments, but on some sets the NCC returns 1.0 when the > images aren't even overlapping. I have the black areas of the image masked > out, and have even tried cranking up the threshold to be sure the darker > areas aren't being included to no avail. Any thoughts? > > -- > > AH > > > > ----------------------------------------------------------------------------------------------- > > *This email and any attachments thereto may contain private, > confidential, and privileged materials for the sole use of the intended > recipient. Any reviewing, copying, or distribution of this email (or any > attachments thereto) by other than the intended recipient is strictly > prohibited. If you are not the intended recipient, please contact the > sender immediately and permanently destroy this email and any attachments > thereto.* > > _____________________________________ > 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 > > > > > _____________________________________ > 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 > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From swetha.bsharma at gmail.com Wed Apr 12 04:11:35 2017 From: swetha.bsharma at gmail.com (Swetha Sharma) Date: Wed, 12 Apr 2017 13:41:35 +0530 Subject: [ITK] [ITK-users] Transforming a point Message-ID: Hi, I have a affine transformation matrix with a set of points as fixed landmarks and moving landmarks. I was trying to verify the transformation by using the transform point method in the transformation class,ideally i should get back the fixed points when i give the moving points as input , but I am not getting it as the output. The code which i used is as below: typedef itk::AffineTransform AffineTransformType; AffineTransformType::Pointer transf; transf = dynamic_cast( transfm.GetPointer() ); typedef itk::Similarity3DTransform SimilarityTransformType; SimilarityTransformType::Pointer transform = SimilarityTransformType::New(); typedef itk::LandmarkBasedTransformInitializer< SimilarityTransformType, InputImageType, InputImageType > LandmarkBasedTransformInitializerType; LandmarkBasedTransformInitializerType::Pointer landmarkBasedTransformInitializer = LandmarkBasedTransformInitializerType::New(); typedef LandmarkBasedTransformInitializerType::LandmarkPointContainer LandmarkContainerType; typedef LandmarkBasedTransformInitializerType::LandmarkPointType LandmarkPointType; LandmarkContainerType movingLandmarks; LandmarkPointType movingPoint; double *ptrf_moving_point = ptf_moving_landmark_pointslist; for(int iPointIndex=0;iPointIndex PointSetType; PointSetType::Pointer registeredPointSet = PointSetType::New(); typedef PointSetType::PointType PointType; PointType registeredPoint; typedef PointSetType::PointsContainer PointsContainer; PointsContainer::Pointer registeredPointContainer = PointsContainer::New(); for(int i=0;iTransformPoint( movingLandmarks[i] ); registeredPointContainer->InsertElement( i, registeredPoint ); } registeredPointSet->SetPoints(registeredPointContainer); //Write the registered pointset into file std::ofstream registeredFile; registeredFile.open( "registered_points.txt"); if( registeredFile.fail() ) { return -1; } for( int i = 0; iGetNumberOfPoints(); i++) { registeredPointSet->GetPoint( i, & registeredPoint ); for(int j = 0; j<3; j++) { registeredFile< -------------- next part -------------- _____________________________________ 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 From sidharta.gupta93 at gmail.com Wed Apr 12 07:44:55 2017 From: sidharta.gupta93 at gmail.com (sidharta) Date: Wed, 12 Apr 2017 04:44:55 -0700 (MST) Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: References: <1491482054290-38074.post@n7.nabble.com> <1491816595489-38084.post@n7.nabble.com> <1491926413097-38091.post@n7.nabble.com> Message-ID: <1491997495031-38097.post@n7.nabble.com> Hi D?enan, Of course I would use that (sorry for not mentioning it that I know this already), but how do I get this particular plane (2D slice)? I don't want to hard code anything. Hope you understand Thank you for your time Sidharta -- View this message in context: http://itk-users.7.n7.nabble.com/Extract-slice-from-ResampleFilter-tp38074p38097.html Sent from the ITK - 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 From francois.budin at kitware.com Wed Apr 12 08:46:12 2017 From: francois.budin at kitware.com (Francois Budin) Date: Wed, 12 Apr 2017 08:46:12 -0400 Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: <1491997495031-38097.post@n7.nabble.com> References: <1491482054290-38074.post@n7.nabble.com> <1491816595489-38084.post@n7.nabble.com> <1491926413097-38091.post@n7.nabble.com> <1491997495031-38097.post@n7.nabble.com> Message-ID: Hello Sidharta, You can use the filter called ExtractImageFilter [1]. You should be able to achieve your goal with that. Hope this helps, Francois [1] https://itk.org/Doxygen/html/classitk_1_1ExtractImageFilter.html On Wed, Apr 12, 2017 at 7:44 AM, sidharta wrote: > Hi D?enan, > > Of course I would use that (sorry for not mentioning it that I know this > already), but how do I get this particular plane (2D slice)? I don't want > to > hard code anything. > > Hope you understand > Thank you for your time > Sidharta > > > > -- > View this message in context: http://itk-users.7.n7.nabble. > com/Extract-slice-from-ResampleFilter-tp38074p38097.html > Sent from the ITK - 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Wed Apr 12 09:03:52 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Wed, 12 Apr 2017 09:03:52 -0400 Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: <1491997495031-38097.post@n7.nabble.com> References: <1491482054290-38074.post@n7.nabble.com> <1491816595489-38084.post@n7.nabble.com> <1491926413097-38091.post@n7.nabble.com> <1491997495031-38097.post@n7.nabble.com> Message-ID: Hi Sidharta, to get the particular plane you want, set up the transform in such a way that that slice gets transformed to some know spatial position (e.g. your first point to coordinates [0,0,0] and your last point to coordinates [1000,0,0]). Then you only need to resample your volume to a 3D image of thickness 1 slice which passes through points [0,0,0] and [1000,0,0]. You don't even need extract filter with this approach. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Wed, Apr 12, 2017 at 7:44 AM, sidharta wrote: > Hi D?enan, > > Of course I would use that (sorry for not mentioning it that I know this > already), but how do I get this particular plane (2D slice)? I don't want > to > hard code anything. > > Hope you understand > Thank you for your time > Sidharta > > > > -- > View this message in context: http://itk-users.7.n7.nabble. > com/Extract-slice-from-ResampleFilter-tp38074p38097.html > Sent from the ITK - 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From zivrafael.yaniv at nih.gov Wed Apr 12 09:41:13 2017 From: zivrafael.yaniv at nih.gov (Yaniv, Ziv Rafael (NIH/NLM/LHC) [C]) Date: Wed, 12 Apr 2017 13:41:13 +0000 Subject: [ITK] [ITK-users] Transforming a point In-Reply-To: References: Message-ID: Hello Swetha, In general, the transformations computed using the ITK registration framework are from the fixed coordinate system to the moving coordinate system. Thus, the transformation should be applied as T(point_fixed) = point_moving. I did not read your code so I may be missing something specific to your work, but this mapping is something that many newcomers to ITK seem to get confused with. hope this helps Ziv From: Swetha Sharma Date: Wednesday, April 12, 2017 at 4:11 AM To: Insight-users Subject: [ITK] [ITK-users] Transforming a point Hi, I have a affine transformation matrix with a set of points as fixed landmarks and moving landmarks. I was trying to verify the transformation by using the transform point method in the transformation class,ideally i should get back the fixed points when i give the moving points as input , but I am not getting it as the output. The code which i used is as below: typedef itk::AffineTransform AffineTransformType; AffineTransformType::Pointer transf; transf = dynamic_cast( transfm.GetPointer() ); typedef itk::Similarity3DTransform SimilarityTransformType; SimilarityTransformType::Pointer transform = SimilarityTransformType::New(); typedef itk::LandmarkBasedTransformInitializer< SimilarityTransformType, InputImageType, InputImageType > LandmarkBasedTransformInitializerType; LandmarkBasedTransformInitializerType::Pointer landmarkBasedTransformInitializer = LandmarkBasedTransformInitializerType::New(); typedef LandmarkBasedTransformInitializerType::LandmarkPointContainer LandmarkContainerType; typedef LandmarkBasedTransformInitializerType::LandmarkPointType LandmarkPointType; LandmarkContainerType movingLandmarks; LandmarkPointType movingPoint; double *ptrf_moving_point = ptf_moving_landmark_pointslist; for(int iPointIndex=0;iPointIndex PointSetType; PointSetType::Pointer registeredPointSet = PointSetType::New(); typedef PointSetType::PointType PointType; PointType registeredPoint; typedef PointSetType::PointsContainer PointsContainer; PointsContainer::Pointer registeredPointContainer = PointsContainer::New(); for(int i=0;iTransformPoint( movingLandmarks[i] ); registeredPointContainer->InsertElement( i, registeredPoint ); } registeredPointSet->SetPoints(registeredPointContainer); //Write the registered pointset into file std::ofstream registeredFile; registeredFile.open( "registered_points.txt"); if( registeredFile.fail() ) { return -1; } for( int i = 0; iGetNumberOfPoints(); i++) { registeredPointSet->GetPoint( i, & registeredPoint ); for(int j = 0; j<3; j++) { registeredFile< -------------- next part -------------- _____________________________________ 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 From fisidoro at ethz.ch Wed Apr 12 14:16:10 2017 From: fisidoro at ethz.ch (D'Isidoro Fabio) Date: Wed, 12 Apr 2017 18:16:10 +0000 Subject: [ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa) In-Reply-To: References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> Message-ID: <50B858FB5F53124F9E32314E5C1B409445968817@MBX212.d.ethz.ch> Thank you. I am trying to build ITK Wrap Python with Module_BridgeNumPy=ON with Visual Studio 2017. I get the following type of errors: 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.10.25017/include\xstring(1905,26): error G3F63BFAE: constexpr variable '_Memcpy_move_offset' must be initialized by a constant expression 12> static constexpr size_t _Memcpy_move_offset = offsetof(_Mydata_t, _Bx); 12> ^ ~~~~~~~~~~~~~~~~~~~~~~~~ 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.10.25017/include\stdexcept:23:21: note: in instantiation of template class 'std::basic_string, std::allocator >' requested here 12> : _Mybase(_Message.c_str()) 12> ^ 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.10.25017/include\xstring:1905:48: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression 12> static constexpr size_t _Memcpy_move_offset = offsetof(_Mydata_t, _Bx); 12> ^ 12>C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0/ucrt\stddef.h:38:32: note: expanded from macro 'offsetof' 12> #define offsetof(s,m) ((size_t)&reinterpret_cast((((s*)0)->m))) The build worked with Visual Studio 2015 instead. Can I fix this issue with Visual Studio 2017 somehow? Thank you. ---------------------------------------------------------------------- Fabio D?Isidoro - PhD Student Institute of Biomechanics HPP O 14 H?nggerbergring 64 8093 Z?rich, Switzerland -----Original Message----- From: Matt McCormick [mailto:matt.mccormick at kitware.com] Sent: Montag, 3. April 2017 20:41 To: D'Isidoro Fabio Cc: insight-users at itk.org Subject: Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) Hallo Fabio, > I use ITK with Python Wrap. I need to interface my Python code with a > Cython-wrapped C++ code that takes only numpy array as input and > returns numpy array as output. Cool. By the way, you may be interested in scikit-build [1], which is a good way to build Cython-wrapped C++ code. We are using it for the ITK and SimpleITK Python packages, and it has good Cython and CMake support. > Hence, I need to convert the Python itk images into numpy array to be > given as input to the wrapped C++ code, and then convert the numpy > array in output from the wrapped C++ code back into python itk images. > > > > Question 1) How can I do that in an efficient way? I found some posts > on itk.PyBuffer but I could not find anywhere any reference on how to > install it on my itk wrap build. Yes, itk.PyBuffer works great for that. Please review a PR for some additional documentation: https://github.com/InsightSoftwareConsortium/ITKBridgeNumPy/pull/18 This has been available in ITK for a few releases as a Remote module, which can be enabled by setting Module_BridgeNumPy=ON in ITK's CMake configuration. Since ITK 4.11.0, it is easier to build since it does not require the NumPy headers. In current ITK Git master (to be 4.12.0) the module is enabled by default. Nightly ITK Python packages for ITK Git master are now being built: https://github.com/InsightSoftwareConsortium/ITKPythonPackage macOS and Linux are available. Windows packages will be available over the coming weeks. > Question 2) The purpose of writing a part of my algorithm in C++ is to > speed up the code. If the conversion between python itk images and > numpy arrays is slow, I would lose all the speed gain obtained with the C++ implementation. > Are there better ways to deal with that? The newer versions ITKBridgeNumPy use a NumPy array view, which does not do any copies during the conversion, and it is very fast. HTH, Matt [1] http://scikit-build.org/ _____________________________________ 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 From dzenanz at gmail.com Wed Apr 12 15:54:09 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Wed, 12 Apr 2017 15:54:09 -0400 Subject: [ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa) In-Reply-To: <50B858FB5F53124F9E32314E5C1B409445968817@MBX212.d.ethz.ch> References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445968817@MBX212.d.ethz.ch> Message-ID: Hi Fabio, let me give it a try with VS2017 and Wrapping+NumPy. I will report back when I have an update. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Wed, Apr 12, 2017 at 2:16 PM, D'Isidoro Fabio wrote: > Thank you. I am trying to build ITK Wrap Python with Module_BridgeNumPy=ON > with Visual Studio 2017. > > I get the following type of errors: > > 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/To > ols/MSVC/14.10.25017/include\xstring(1905,26): error G3F63BFAE: constexpr > variable '_Memcpy_move_offset' must be initialized by a constant expression > 12> static constexpr size_t _Memcpy_move_offset = > offsetof(_Mydata_t, _Bx); > 12> ^ > ~~~~~~~~~~~~~~~~~~~~~~~~ > 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/To > ols/MSVC/14.10.25017/include\stdexcept:23:21: note: in instantiation of > template class 'std::basic_string, > std::allocator >' requested here > 12> : _Mybase(_Message.c_str()) > 12> ^ > 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/To > ols/MSVC/14.10.25017/include\xstring:1905:48: note: cast that performs > the conversions of a reinterpret_cast is not allowed in a constant > expression > 12> static constexpr size_t _Memcpy_move_offset = > offsetof(_Mydata_t, _Bx); > 12> ^ > 12>C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0/ucrt\stddef.h:38:32: > note: expanded from macro 'offsetof' > 12> #define offsetof(s,m) ((size_t)&reinterpret_cast volatile&>((((s*)0)->m))) > > > The build worked with Visual Studio 2015 instead. > > Can I fix this issue with Visual Studio 2017 somehow? > > Thank you. > > ---------------------------------------------------------------------- > Fabio D?Isidoro - PhD Student > Institute of Biomechanics > HPP O 14 > H?nggerbergring 64 > 8093 Z?rich, Switzerland > > -----Original Message----- > From: Matt McCormick [mailto:matt.mccormick at kitware.com] > Sent: Montag, 3. April 2017 20:41 > To: D'Isidoro Fabio > Cc: insight-users at itk.org > Subject: Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) > > Hallo Fabio, > > > > I use ITK with Python Wrap. I need to interface my Python code with a > > Cython-wrapped C++ code that takes only numpy array as input and > > returns numpy array as output. > > Cool. By the way, you may be interested in scikit-build [1], which is a > good way to build Cython-wrapped C++ code. We are using it for the ITK and > SimpleITK Python packages, and it has good Cython and CMake support. > > > > Hence, I need to convert the Python itk images into numpy array to be > > given as input to the wrapped C++ code, and then convert the numpy > > array in output from the wrapped C++ code back into python itk images. > > > > > > > > Question 1) How can I do that in an efficient way? I found some posts > > on itk.PyBuffer but I could not find anywhere any reference on how to > > install it on my itk wrap build. > > Yes, itk.PyBuffer works great for that. Please review a PR for some > additional documentation: > > https://github.com/InsightSoftwareConsortium/ITKBridgeNumPy/pull/18 > > This has been available in ITK for a few releases as a Remote module, > which can be enabled by setting > > Module_BridgeNumPy=ON > > in ITK's CMake configuration. > > > Since ITK 4.11.0, it is easier to build since it does not require the > NumPy headers. > > > In current ITK Git master (to be 4.12.0) the module is enabled by default. > > > Nightly ITK Python packages for ITK Git master are now being built: > > https://github.com/InsightSoftwareConsortium/ITKPythonPackage > > macOS and Linux are available. Windows packages will be available over the > coming weeks. > > > > > Question 2) The purpose of writing a part of my algorithm in C++ is to > > speed up the code. If the conversion between python itk images and > > numpy arrays is slow, I would lose all the speed gain obtained with the > C++ implementation. > > Are there better ways to deal with that? > > The newer versions ITKBridgeNumPy use a NumPy array view, which does not > do any copies during the conversion, and it is very fast. > > > HTH, > Matt > > > [1] http://scikit-build.org/ > _____________________________________ > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From fisidoro at ethz.ch Wed Apr 12 16:02:58 2017 From: fisidoro at ethz.ch (D'Isidoro Fabio) Date: Wed, 12 Apr 2017 20:02:58 +0000 Subject: [ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa) In-Reply-To: References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445968817@MBX212.d.ethz.ch> Message-ID: <50B858FB5F53124F9E32314E5C1B409445968862@MBX212.d.ethz.ch> Ok, thanks. Moe specifically I am using now Visual Studio 2017 Preview. Fabio. From: D?enan Zuki? [mailto:dzenanz at gmail.com] Sent: Mittwoch, 12. April 2017 21:54 To: D'Isidoro Fabio Cc: Matt McCormick ; insight-users at itk.org Subject: Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) Hi Fabio, let me give it a try with VS2017 and Wrapping+NumPy. I will report back when I have an update. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Wed, Apr 12, 2017 at 2:16 PM, D'Isidoro Fabio > wrote: Thank you. I am trying to build ITK Wrap Python with Module_BridgeNumPy=ON with Visual Studio 2017. I get the following type of errors: 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.10.25017/include\xstring(1905,26): error G3F63BFAE: constexpr variable '_Memcpy_move_offset' must be initialized by a constant expression 12> static constexpr size_t _Memcpy_move_offset = offsetof(_Mydata_t, _Bx); 12> ^ ~~~~~~~~~~~~~~~~~~~~~~~~ 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.10.25017/include\stdexcept:23:21: note: in instantiation of template class 'std::basic_string, std::allocator >' requested here 12> : _Mybase(_Message.c_str()) 12> ^ 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.10.25017/include\xstring:1905:48: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression 12> static constexpr size_t _Memcpy_move_offset = offsetof(_Mydata_t, _Bx); 12> ^ 12>C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0/ucrt\stddef.h:38:32: note: expanded from macro 'offsetof' 12> #define offsetof(s,m) ((size_t)&reinterpret_cast((((s*)0)->m))) The build worked with Visual Studio 2015 instead. Can I fix this issue with Visual Studio 2017 somehow? Thank you. ---------------------------------------------------------------------- Fabio D?Isidoro - PhD Student Institute of Biomechanics HPP O 14 H?nggerbergring 64 8093 Z?rich, Switzerland -----Original Message----- From: Matt McCormick [mailto:matt.mccormick at kitware.com] Sent: Montag, 3. April 2017 20:41 To: D'Isidoro Fabio > Cc: insight-users at itk.org Subject: Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) Hallo Fabio, > I use ITK with Python Wrap. I need to interface my Python code with a > Cython-wrapped C++ code that takes only numpy array as input and > returns numpy array as output. Cool. By the way, you may be interested in scikit-build [1], which is a good way to build Cython-wrapped C++ code. We are using it for the ITK and SimpleITK Python packages, and it has good Cython and CMake support. > Hence, I need to convert the Python itk images into numpy array to be > given as input to the wrapped C++ code, and then convert the numpy > array in output from the wrapped C++ code back into python itk images. > > > > Question 1) How can I do that in an efficient way? I found some posts > on itk.PyBuffer but I could not find anywhere any reference on how to > install it on my itk wrap build. Yes, itk.PyBuffer works great for that. Please review a PR for some additional documentation: https://github.com/InsightSoftwareConsortium/ITKBridgeNumPy/pull/18 This has been available in ITK for a few releases as a Remote module, which can be enabled by setting Module_BridgeNumPy=ON in ITK's CMake configuration. Since ITK 4.11.0, it is easier to build since it does not require the NumPy headers. In current ITK Git master (to be 4.12.0) the module is enabled by default. Nightly ITK Python packages for ITK Git master are now being built: https://github.com/InsightSoftwareConsortium/ITKPythonPackage macOS and Linux are available. Windows packages will be available over the coming weeks. > Question 2) The purpose of writing a part of my algorithm in C++ is to > speed up the code. If the conversion between python itk images and > numpy arrays is slow, I would lose all the speed gain obtained with the C++ implementation. > Are there better ways to deal with that? The newer versions ITKBridgeNumPy use a NumPy array view, which does not do any copies during the conversion, and it is very fast. HTH, Matt [1] http://scikit-build.org/ _____________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Wed Apr 12 16:26:06 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Wed, 12 Apr 2017 16:26:06 -0400 Subject: [ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa) In-Reply-To: <50B858FB5F53124F9E32314E5C1B409445968862@MBX212.d.ethz.ch> References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445968817@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445968862@MBX212.d.ethz.ch> Message-ID: I reproduced the error. I am looking into fixing it. On Wed, Apr 12, 2017 at 4:02 PM, D'Isidoro Fabio wrote: > Ok, thanks. Moe specifically I am using now *Visual Studio 2017 Preview*. > > > > Fabio. > > *From:* D?enan Zuki? [mailto:dzenanz at gmail.com] > *Sent:* Mittwoch, 12. April 2017 21:54 > *To:* D'Isidoro Fabio > *Cc:* Matt McCormick ; insight-users at itk.org > > *Subject:* Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) > > > > Hi Fabio, > > > > let me give it a try with VS2017 and Wrapping+NumPy. I will report back > when I have an update. > > > > Regards, > > D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) > > > > On Wed, Apr 12, 2017 at 2:16 PM, D'Isidoro Fabio wrote: > > Thank you. I am trying to build ITK Wrap Python with Module_BridgeNumPy=ON > with Visual Studio 2017. > > I get the following type of errors: > > 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/ > Tools/MSVC/14.10.25017/include\xstring(1905,26): error G3F63BFAE: > constexpr variable '_Memcpy_move_offset' must be initialized by a constant > expression > 12> static constexpr size_t _Memcpy_move_offset = > offsetof(_Mydata_t, _Bx); > 12> ^ > ~~~~~~~~~~~~~~~~~~~~~~~~ > 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/ > Tools/MSVC/14.10.25017/include\stdexcept:23:21: note: in instantiation of > template class 'std::basic_string, > std::allocator >' requested here > 12> : _Mybase(_Message.c_str()) > 12> ^ > 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/ > Tools/MSVC/14.10.25017/include\xstring:1905:48: note: cast that performs > the conversions of a reinterpret_cast is not allowed in a constant > expression > 12> static constexpr size_t _Memcpy_move_offset = > offsetof(_Mydata_t, _Bx); > 12> ^ > 12>C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0/ucrt\stddef.h:38:32: > note: expanded from macro 'offsetof' > 12> #define offsetof(s,m) ((size_t)&reinterpret_cast volatile&>((((s*)0)->m))) > > > The build worked with Visual Studio 2015 instead. > > Can I fix this issue with Visual Studio 2017 somehow? > > Thank you. > > ---------------------------------------------------------------------- > Fabio D?Isidoro - PhD Student > Institute of Biomechanics > HPP O 14 > H?nggerbergring 64 > 8093 Z?rich, Switzerland > > > -----Original Message----- > From: Matt McCormick [mailto:matt.mccormick at kitware.com] > Sent: Montag, 3. April 2017 20:41 > To: D'Isidoro Fabio > Cc: insight-users at itk.org > Subject: Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) > > Hallo Fabio, > > > > I use ITK with Python Wrap. I need to interface my Python code with a > > Cython-wrapped C++ code that takes only numpy array as input and > > returns numpy array as output. > > Cool. By the way, you may be interested in scikit-build [1], which is a > good way to build Cython-wrapped C++ code. We are using it for the ITK and > SimpleITK Python packages, and it has good Cython and CMake support. > > > > Hence, I need to convert the Python itk images into numpy array to be > > given as input to the wrapped C++ code, and then convert the numpy > > array in output from the wrapped C++ code back into python itk images. > > > > > > > > Question 1) How can I do that in an efficient way? I found some posts > > on itk.PyBuffer but I could not find anywhere any reference on how to > > install it on my itk wrap build. > > Yes, itk.PyBuffer works great for that. Please review a PR for some > additional documentation: > > https://github.com/InsightSoftwareConsortium/ITKBridgeNumPy/pull/18 > > This has been available in ITK for a few releases as a Remote module, > which can be enabled by setting > > Module_BridgeNumPy=ON > > in ITK's CMake configuration. > > > Since ITK 4.11.0, it is easier to build since it does not require the > NumPy headers. > > > In current ITK Git master (to be 4.12.0) the module is enabled by default. > > > Nightly ITK Python packages for ITK Git master are now being built: > > https://github.com/InsightSoftwareConsortium/ITKPythonPackage > > macOS and Linux are available. Windows packages will be available over the > coming weeks. > > > > > Question 2) The purpose of writing a part of my algorithm in C++ is to > > speed up the code. If the conversion between python itk images and > > numpy arrays is slow, I would lose all the speed gain obtained with the > C++ implementation. > > Are there better ways to deal with that? > > The newer versions ITKBridgeNumPy use a NumPy array view, which does not > do any copies during the conversion, and it is very fast. > > > HTH, > Matt > > > [1] http://scikit-build.org/ > _____________________________________ > 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 > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From francois.budin at kitware.com Wed Apr 12 16:26:34 2017 From: francois.budin at kitware.com (Francois Budin) Date: Wed, 12 Apr 2017 16:26:34 -0400 Subject: [ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa) In-Reply-To: <50B858FB5F53124F9E32314E5C1B409445968862@MBX212.d.ethz.ch> References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445968817@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445968862@MBX212.d.ethz.ch> Message-ID: Fabio, To add a little bit of extra information about using BridgeNumpy: >From NumPy to ITK, the memory is never copied, and always shared between the NumPy array and the ITK image. >From ITK to NumPy, the memory is not copied at first, if the data is not changed from the NumPy side (e.g. if the ITK image is changed, the NumPy array will be modified too), but if you modify the NumPy array directly, NumPy will create a copy of the data. This also means that if you were to modify the NumPy array, the modifications would not be visible in the ITK image. A limited workaround to this is: # Get NumPy array from image arr_image = itk.GetArrayFromImage(image) # Create copy of array that can be modified in-place arr = arr_image.copy() # Modify array ? # Update image in-place with new array arr_image.setfield(arr,arr_image.dtype) The advantage of this method is that the image will be updated. However, there is an explicit copy of your data. If the copy step is skipped and the original NumPy array is modified, a copy of the data will be performed by NumPy and you may not be aware of it until you see that the data in the NumPy array and the image do not match anymore. Hope this helps, Francois On Wed, Apr 12, 2017 at 4:02 PM, D'Isidoro Fabio wrote: > Ok, thanks. Moe specifically I am using now *Visual Studio 2017 Preview*. > > > > Fabio. > > *From:* D?enan Zuki? [mailto:dzenanz at gmail.com] > *Sent:* Mittwoch, 12. April 2017 21:54 > *To:* D'Isidoro Fabio > *Cc:* Matt McCormick ; insight-users at itk.org > > *Subject:* Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) > > > > Hi Fabio, > > > > let me give it a try with VS2017 and Wrapping+NumPy. I will report back > when I have an update. > > > > Regards, > > D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) > > > > On Wed, Apr 12, 2017 at 2:16 PM, D'Isidoro Fabio wrote: > > Thank you. I am trying to build ITK Wrap Python with Module_BridgeNumPy=ON > with Visual Studio 2017. > > I get the following type of errors: > > 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/ > Tools/MSVC/14.10.25017/include\xstring(1905,26): error G3F63BFAE: > constexpr variable '_Memcpy_move_offset' must be initialized by a constant > expression > 12> static constexpr size_t _Memcpy_move_offset = > offsetof(_Mydata_t, _Bx); > 12> ^ > ~~~~~~~~~~~~~~~~~~~~~~~~ > 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/ > Tools/MSVC/14.10.25017/include\stdexcept:23:21: note: in instantiation of > template class 'std::basic_string, > std::allocator >' requested here > 12> : _Mybase(_Message.c_str()) > 12> ^ > 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/ > Tools/MSVC/14.10.25017/include\xstring:1905:48: note: cast that performs > the conversions of a reinterpret_cast is not allowed in a constant > expression > 12> static constexpr size_t _Memcpy_move_offset = > offsetof(_Mydata_t, _Bx); > 12> ^ > 12>C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0/ucrt\stddef.h:38:32: > note: expanded from macro 'offsetof' > 12> #define offsetof(s,m) ((size_t)&reinterpret_cast volatile&>((((s*)0)->m))) > > > The build worked with Visual Studio 2015 instead. > > Can I fix this issue with Visual Studio 2017 somehow? > > Thank you. > > ---------------------------------------------------------------------- > Fabio D?Isidoro - PhD Student > Institute of Biomechanics > HPP O 14 > H?nggerbergring 64 > 8093 Z?rich, Switzerland > > > -----Original Message----- > From: Matt McCormick [mailto:matt.mccormick at kitware.com] > Sent: Montag, 3. April 2017 20:41 > To: D'Isidoro Fabio > Cc: insight-users at itk.org > Subject: Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) > > Hallo Fabio, > > > > I use ITK with Python Wrap. I need to interface my Python code with a > > Cython-wrapped C++ code that takes only numpy array as input and > > returns numpy array as output. > > Cool. By the way, you may be interested in scikit-build [1], which is a > good way to build Cython-wrapped C++ code. We are using it for the ITK and > SimpleITK Python packages, and it has good Cython and CMake support. > > > > Hence, I need to convert the Python itk images into numpy array to be > > given as input to the wrapped C++ code, and then convert the numpy > > array in output from the wrapped C++ code back into python itk images. > > > > > > > > Question 1) How can I do that in an efficient way? I found some posts > > on itk.PyBuffer but I could not find anywhere any reference on how to > > install it on my itk wrap build. > > Yes, itk.PyBuffer works great for that. Please review a PR for some > additional documentation: > > https://github.com/InsightSoftwareConsortium/ITKBridgeNumPy/pull/18 > > This has been available in ITK for a few releases as a Remote module, > which can be enabled by setting > > Module_BridgeNumPy=ON > > in ITK's CMake configuration. > > > Since ITK 4.11.0, it is easier to build since it does not require the > NumPy headers. > > > In current ITK Git master (to be 4.12.0) the module is enabled by default. > > > Nightly ITK Python packages for ITK Git master are now being built: > > https://github.com/InsightSoftwareConsortium/ITKPythonPackage > > macOS and Linux are available. Windows packages will be available over the > coming weeks. > > > > > Question 2) The purpose of writing a part of my algorithm in C++ is to > > speed up the code. If the conversion between python itk images and > > numpy arrays is slow, I would lose all the speed gain obtained with the > C++ implementation. > > Are there better ways to deal with that? > > The newer versions ITKBridgeNumPy use a NumPy array view, which does not > do any copies during the conversion, and it is very fast. > > > HTH, > Matt > > > [1] http://scikit-build.org/ > _____________________________________ > 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 > > > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Wed Apr 12 16:50:08 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Wed, 12 Apr 2017 16:50:08 -0400 Subject: [ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa) In-Reply-To: References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445968817@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445968862@MBX212.d.ethz.ch> Message-ID: Hi Fabio, it looks like we will have to wait somewhat until VS writers get around to implement __builtin_offsetof I don't know why it doesn't trigger when Python wrapping is OFF. I will look into it more. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Wed, Apr 12, 2017 at 4:26 PM, Francois Budin wrote: > Fabio, > > To add a little bit of extra information about using BridgeNumpy: > > From NumPy to ITK, the memory is never copied, and always shared between > the NumPy array and the ITK image. > From ITK to NumPy, the memory is not copied at first, if the data is not > changed from the NumPy side (e.g. if the ITK image is changed, the NumPy > array will be modified too), but if you modify the NumPy array directly, > NumPy will create a copy of the data. This also means that if you were to > modify the NumPy array, the modifications would not be visible in the ITK > image. > > A limited workaround to this is: > > # Get NumPy array from image > arr_image = itk.GetArrayFromImage(image) > # Create copy of array that can be modified in-place > arr = arr_image.copy() > # Modify array > ? > # Update image in-place with new array > arr_image.setfield(arr,arr_image.dtype) > > The advantage of this method is that the image will be updated. However, > there is an explicit copy of your data. > If the copy step is skipped and the original NumPy array is modified, a > copy of the data will be performed by NumPy and you may not be aware of it > until you see that the data in the NumPy array and the image do not match > anymore. > > Hope this helps, > Francois > > On Wed, Apr 12, 2017 at 4:02 PM, D'Isidoro Fabio wrote: > >> Ok, thanks. Moe specifically I am using now *Visual Studio 2017 Preview*. >> >> >> >> Fabio. >> >> *From:* D?enan Zuki? [mailto:dzenanz at gmail.com] >> *Sent:* Mittwoch, 12. April 2017 21:54 >> *To:* D'Isidoro Fabio >> *Cc:* Matt McCormick ; insight-users at itk.org >> >> *Subject:* Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) >> >> >> >> Hi Fabio, >> >> >> >> let me give it a try with VS2017 and Wrapping+NumPy. I will report back >> when I have an update. >> >> >> >> Regards, >> >> D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) >> >> >> >> On Wed, Apr 12, 2017 at 2:16 PM, D'Isidoro Fabio >> wrote: >> >> Thank you. I am trying to build ITK Wrap Python with >> Module_BridgeNumPy=ON with Visual Studio 2017. >> >> I get the following type of errors: >> >> 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/To >> ols/MSVC/14.10.25017/include\xstring(1905,26): error G3F63BFAE: >> constexpr variable '_Memcpy_move_offset' must be initialized by a constant >> expression >> 12> static constexpr size_t _Memcpy_move_offset = >> offsetof(_Mydata_t, _Bx); >> 12> ^ >> ~~~~~~~~~~~~~~~~~~~~~~~~ >> 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/To >> ols/MSVC/14.10.25017/include\stdexcept:23:21: note: in instantiation of >> template class 'std::basic_string, >> std::allocator >' requested here >> 12> : _Mybase(_Message.c_str()) >> 12> ^ >> 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/To >> ols/MSVC/14.10.25017/include\xstring:1905:48: note: cast that performs >> the conversions of a reinterpret_cast is not allowed in a constant >> expression >> 12> static constexpr size_t _Memcpy_move_offset = >> offsetof(_Mydata_t, _Bx); >> 12> ^ >> 12>C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0/ucrt\stddef.h:38:32: >> note: expanded from macro 'offsetof' >> 12> #define offsetof(s,m) ((size_t)&reinterpret_cast> volatile&>((((s*)0)->m))) >> >> >> The build worked with Visual Studio 2015 instead. >> >> Can I fix this issue with Visual Studio 2017 somehow? >> >> Thank you. >> >> ---------------------------------------------------------------------- >> Fabio D?Isidoro - PhD Student >> Institute of Biomechanics >> HPP O 14 >> H?nggerbergring 64 >> 8093 Z?rich, Switzerland >> >> >> -----Original Message----- >> From: Matt McCormick [mailto:matt.mccormick at kitware.com] >> Sent: Montag, 3. April 2017 20:41 >> To: D'Isidoro Fabio >> Cc: insight-users at itk.org >> Subject: Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) >> >> Hallo Fabio, >> >> >> > I use ITK with Python Wrap. I need to interface my Python code with a >> > Cython-wrapped C++ code that takes only numpy array as input and >> > returns numpy array as output. >> >> Cool. By the way, you may be interested in scikit-build [1], which is a >> good way to build Cython-wrapped C++ code. We are using it for the ITK and >> SimpleITK Python packages, and it has good Cython and CMake support. >> >> >> > Hence, I need to convert the Python itk images into numpy array to be >> > given as input to the wrapped C++ code, and then convert the numpy >> > array in output from the wrapped C++ code back into python itk images. >> > >> > >> > >> > Question 1) How can I do that in an efficient way? I found some posts >> > on itk.PyBuffer but I could not find anywhere any reference on how to >> > install it on my itk wrap build. >> >> Yes, itk.PyBuffer works great for that. Please review a PR for some >> additional documentation: >> >> https://github.com/InsightSoftwareConsortium/ITKBridgeNumPy/pull/18 >> >> This has been available in ITK for a few releases as a Remote module, >> which can be enabled by setting >> >> Module_BridgeNumPy=ON >> >> in ITK's CMake configuration. >> >> >> Since ITK 4.11.0, it is easier to build since it does not require the >> NumPy headers. >> >> >> In current ITK Git master (to be 4.12.0) the module is enabled by default. >> >> >> Nightly ITK Python packages for ITK Git master are now being built: >> >> https://github.com/InsightSoftwareConsortium/ITKPythonPackage >> >> macOS and Linux are available. Windows packages will be available over >> the coming weeks. >> >> >> >> > Question 2) The purpose of writing a part of my algorithm in C++ is to >> > speed up the code. If the conversion between python itk images and >> > numpy arrays is slow, I would lose all the speed gain obtained with the >> C++ implementation. >> > Are there better ways to deal with that? >> >> The newer versions ITKBridgeNumPy use a NumPy array view, which does not >> do any copies during the conversion, and it is very fast. >> >> >> HTH, >> Matt >> >> >> [1] http://scikit-build.org/ >> _____________________________________ >> 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 >> >> >> >> _____________________________________ >> 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 >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From swetha.bsharma at gmail.com Thu Apr 13 01:12:20 2017 From: swetha.bsharma at gmail.com (Swetha Sharma) Date: Thu, 13 Apr 2017 05:12:20 +0000 Subject: [ITK] [ITK-users] Transforming a point In-Reply-To: References: Message-ID: It was helpful thanks ziv Swetha On Wed, 12 Apr 2017, 19:11 Yaniv, Ziv Rafael (NIH/NLM/LHC) [C], < zivrafael.yaniv at nih.gov> wrote: > Hello Swetha, > > > > In general, the transformations computed using the ITK registration > framework are from the fixed coordinate system to the moving coordinate > system. Thus, the transformation should be applied as T(point_fixed) = > point_moving. > > > > I did not read your code so I may be missing something specific to your > work, but this mapping is something that many newcomers to ITK seem to get > confused with. > > > > hope this helps > > Ziv > > > > > > *From: *Swetha Sharma > *Date: *Wednesday, April 12, 2017 at 4:11 AM > *To: *Insight-users > *Subject: *[ITK] [ITK-users] Transforming a point > > > > Hi, > > > > I have a affine transformation matrix with a set of points as fixed > landmarks and moving landmarks. I was trying to verify the transformation > by using the transform point method in the transformation class,ideally i > should get back the fixed points when i give the moving points as input , > but I am not getting it as the output. The code which i used is as below: > > > > typedef itk::AffineTransform AffineTransformType; > > AffineTransformType::Pointer transf; > > > > transf = dynamic_cast( transfm.GetPointer() ); > > typedef itk::Similarity3DTransform SimilarityTransformType; > > SimilarityTransformType::Pointer transform = > SimilarityTransformType::New(); > > > > typedef itk::LandmarkBasedTransformInitializer< SimilarityTransformType, > InputImageType, InputImageType > > > LandmarkBasedTransformInitializerType; > > LandmarkBasedTransformInitializerType::Pointer > landmarkBasedTransformInitializer = > > LandmarkBasedTransformInitializerType::New(); > > > > typedef LandmarkBasedTransformInitializerType::LandmarkPointContainer > LandmarkContainerType; > > typedef LandmarkBasedTransformInitializerType::LandmarkPointType > LandmarkPointType; > > > > LandmarkContainerType movingLandmarks; > > > > LandmarkPointType movingPoint; > > > > double *ptrf_moving_point = ptf_moving_landmark_pointslist; > > for(int > iPointIndex=0;iPointIndex > movingPoint[0] = (*( ptrf_moving_point )) ; > > movingPoint[1] = (*( ptrf_moving_point + 1)); > > movingPoint[2] = (*( ptrf_moving_point + 2)); > > movingLandmarks.push_back( movingPoint ); > > ptrf_moving_point = ptrf_moving_point + 3; > > } > > > > typedef itk::PointSet< double, 3 > PointSetType; > > PointSetType::Pointer registeredPointSet = PointSetType::New(); > > typedef PointSetType::PointType PointType; > > PointType registeredPoint; > > typedef PointSetType::PointsContainer PointsContainer; > > PointsContainer::Pointer registeredPointContainer = > PointsContainer::New(); > > > > for(int i=0;i > registeredPoint = transf->TransformPoint( movingLandmarks[i] ); > > registeredPointContainer->InsertElement( i, registeredPoint ); > > } > > > > registeredPointSet->SetPoints(registeredPointContainer); > > > > //Write the registered pointset into file > > std::ofstream registeredFile; > > registeredFile.open( "registered_points.txt"); > > if( registeredFile.fail() ) > > { > > return -1; > > } > > for( int i = 0; iGetNumberOfPoints(); i++) > > { > > registeredPointSet->GetPoint( i, & registeredPoint ); > > for(int j = 0; j<3; j++) > > { > > registeredFile< > } > > registeredFile<<"\n"; > > } > > > > Is there a mistake in the code ?How do I transform the points? > > -swetha > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From niels-xtk at xs4all.nl Thu Apr 13 05:30:47 2017 From: niels-xtk at xs4all.nl (Niels Dekker) Date: Thu, 13 Apr 2017 11:30:47 +0200 Subject: [ITK] [ITK-dev] Static link "error LNK2005: png_get_uint_31 already defined in png.lib", missing #define in itk_png_mangle.h? In-Reply-To: References: <21acf28759ecc26926c0ac9b01080102@xs4all.nl> Message-ID: For the record, Our proposed fix, submitted by Floris, is at http://review.source.kitware.com/#/c/22282/ Kind regards, Niels Francois Budin schreef op 2017-04-11 17:53: > Thanks Niels. Let us know if you are running into any problem during > that process. > > Francois > > On Tue, Apr 11, 2017 at 11:49 AM, Niels Dekker > wrote: > >> Thank you for your supportive replies, Matt and Francois. My >> colleague Floris Berendsen and I will try to submit a patch for this >> issue later this week. >> >> Kind regards, Niels >> >> Francois Budin wrote op 2017-04-11 15:35: >> Hello Niels, >> >> Thank you for reporting this issue. I looked into itk_png_mangle.h >> and >> indeed it looks like the function 'png_get_uint_31' should be >> renamed >> and is not. >> Using this command [1], updated to your ITK version, you should be >> able to see the the functions that are missing and need to be added >> to >> itk_png_mangle.h . >> It would be great if you commit submit a patch to ITK to correct >> this >> issue. >> You can find step by step instructions about how to contribute here >> [2]. Feel free to reach out if you have any problem during this >> process. >> >> Thank you so much for your help, >> Francois >> >> [1] >> https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/ThirdParty/PNG/src/itkpng/itk_png_mangle.h#L13-L15 >> [2] https://itk.org/Wiki/ITK/Git/Develop >> >> On Tue, Apr 11, 2017 at 9:11 AM, Niels Dekker wrote: >> >> When trying build our project, which links statically to both ITK >> and the Niftyreg library, my colleague Floris Berendsen and I >> encountered the following link error: >> >> itkpng-4.10.lib(pngrutil.obj) : error LNK2005: png_get_uint_31 >> already defined in png.lib(pngrutil.obj) >> [...\SuperElastix-build\Testing\Unit\selxAnyFileIOTest.vcxproj] >> ...\SuperElastix-build\bin\Debug\selxAnyFileIOTest.exe : fatal >> error LNK1169: one or more multiply defined symbols found >> [...\SuperElastix-build\Testing\Unit\selxAnyFileIOTest.vcxproj] >> >> It appears that ITK and Niftyreg link to different versions of >> libpng. Fortunately, ITK has done name mangling for most of the >> libpng API functions, to avoid such linking errors, as we can see at >> Modules/ThirdParty/PNG/src/itkpng/itk_png_mangle.h Now it appears >> that the function "png_get_uint_31" is also exported by libpng, but >> that function is not mangled by ITK! We could locally fix our link >> error by adding an extra #define to "itk_png_mangle.h": >> >> #define png_get_uint_31 itk_png_get_uint_31 >> >> Do you guys agree that that would be an appropriate fix? Could such >> a fix be added to the ITK code base? >> >> Kind regards, Niels >> >> PS Our project, SuperElastix, can be found at >> https://github.com/SuperElastix/SuperElastix [3] (We tried to build >> the SuperBuild from the development branch.) The Nifty Reg library >> is from https://cmiclab.cs.ucl.ac.uk/mmodat/niftyreg [4] -- Niels Dekker Scientific programmer LKEB, Leiden University Medical Center, Netherlands _______________________________________________ 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://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-developers From wangtao_ at sjtu.edu.cn Thu Apr 13 08:25:37 2017 From: wangtao_ at sjtu.edu.cn (wangtaoiz) Date: Thu, 13 Apr 2017 05:25:37 -0700 (MST) Subject: [ITK] [ITK-users] HistogramEqualization in ITK Message-ID: <1492086337666-38108.post@n7.nabble.com> Dear all I want to use itk::AdaptiveHistogramEqualizationImageFilter to do a HistogramEqualization filter on a image as follow: So I set the parameters SetAlpha(0.5), SetBeta(0.5), the result is as follow: but actually the result I want is showed as follow (which is generated by opencv cvEqualizeHist() function): So I want to ask you if I can get that HistogramEqualization result by ITK? Thanks a lot Wang -- View this message in context: http://itk-users.7.n7.nabble.com/HistogramEqualization-in-ITK-tp38108.html Sent from the ITK - 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 From blowekamp at mail.nih.gov Thu Apr 13 09:00:28 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Thu, 13 Apr 2017 13:00:28 +0000 Subject: [ITK] [ITK-users] HistogramEqualization in ITK In-Reply-To: <1492086337666-38108.post@n7.nabble.com> References: <1492086337666-38108.post@n7.nabble.com> Message-ID: <88D11A0A-4B06-4DF1-9BE5-F13D5B9A7550@mail.nih.gov> Hello, You need to read and study the two algorithms closer. There is a referenced paper in the ITK documentation[1]. You should also look into the HistogramMatchingImageFilter [2]. HTH, Brad [1] https://itk.org/Doxygen/html/classitk_1_1AdaptiveHistogramEqualizationImageFilter.html [2] https://itk.org/Doxygen/html/classitk_1_1HistogramMatchingImageFilter.html > On Apr 13, 2017, at 8:25 AM, wangtaoiz wrote: > > Dear all > I want to use itk::AdaptiveHistogramEqualizationImageFilter to do a > HistogramEqualization filter on a image as follow: > > So I set the parameters SetAlpha(0.5), SetBeta(0.5), the result is as > follow: > > but actually the result I want is showed as follow (which is generated by > opencv cvEqualizeHist() function): > > So I want to ask you if I can get that HistogramEqualization result by ITK? > > Thanks a lot > Wang > > > > -- > View this message in context: http://itk-users.7.n7.nabble.com/HistogramEqualization-in-ITK-tp38108.html > Sent from the ITK - 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 > _______________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community _____________________________________ 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 From sidharta.gupta93 at gmail.com Thu Apr 13 09:04:04 2017 From: sidharta.gupta93 at gmail.com (sidharta) Date: Thu, 13 Apr 2017 06:04:04 -0700 (MST) Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: References: <1491482054290-38074.post@n7.nabble.com> <1491816595489-38084.post@n7.nabble.com> <1491926413097-38091.post@n7.nabble.com> <1491997495031-38097.post@n7.nabble.com> Message-ID: <1492088644485-38110.post@n7.nabble.com> Hi D?enan, So I am doing something as follows: // Vectors for calculating normal_to_plane - The plane/slice I want to extract Vector3d ST, SP, normal_to_plane; // This is a custom 3D Vector library ST = traj_start - traj_end; // start and end of the trajectory - vector 1 SP = traj_start - third_point; // start and third point gives another vector - vector 2 // Now with two vectors I can get the direction of the normal to the plane normal_to_plane = ST.cross(SP); // cross product essentially // Getting angles between normal to the plane and the coordinate axes double angle_plane_z = std::acos((normal_to_plane[2] * 1) / norm(normal_to_plane)); // angle between plane and z axis double angle_plane_y = std::acos((normal_to_plane[1] * 1) / norm(normal_to_plane)); // angle between plane and y axis double angle_plane_x = std::acos((normal_to_plane[0] * 1) / norm(normal_to_plane)); // angle between plane and x axis // Instantiate an Euler Transform typedef itk::Euler3DTransform ETransformType; ETransformType::Pointer eulerTransform = ETransformType::New(); // This because - Quote from ITKSoftwareGuide "Rotations are performed around the origin of physical coordinates?not the image origin nor the image center" ETransformType::OutputVectorType translation1; translation1[0] = -origin_dcm[0]; // origin_dcm is the origin of the dicom translation1[1] = -origin_dcm[1]; translation1[2] = -origin_dcm[2]; eulerTransform->Translate(translation1); eulerTransform->SetRotation(angle_plane_x, angle_plane_y, angle_plane_z); // Get back to the origin of the dicom ETransformType::OutputVectorType translation2; translation2[0] = origin_dcm[0]; translation2[1] = origin_dcm[1]; translation2[2] = origin_dcm[2]; // Instantiate the ResampleFilter // typedef double InternalPixelType; // typedef itk::Image< InternalPixelType, Dimension > InternalImageType; // For clarity typedef itk::ResampleImageFilter ResampleFilterType; ResampleFilterType::Pointer filter = ResampleFilterType::New(); typedef itk::NearestNeighborInterpolateImageFunction< InternalImageType, double> InterpolatorType; InterpolatorType::Pointer interpolator = InterpolatorType::New(); filter->SetInterpolator(interpolator); filter->SetDefaultPixelValue(0); filter->SetOutputSpacing(image->GetSpacing()); filter->SetOutputOrigin(image->GetOrigin()); // If I change this to traj_start, the dicom looks completely off, as in not intended. filter->SetOutputDirection(image->GetDirection()); // I have my doubts about this too filter->SetSize(image->GetSize()); // Of course, as you suggested, I would set the thickness here as 1, but I was doing this for testing purposes. filter->SetInput(image); So, what do you think about this code? Am I doing it correctly? I feel really dumb asking you to check my code but unfortunately I can't find any relevant example for 3D resampling. Additionally, (no offense) but I don't get what you mean by "target region index" with respect to the resampling filter? Do you mean the SetOrigin()? As you also see, I am essentially not applying any translation to the origin. Just a rotation for testing purposes. Thank you for your time. Best Regards, Sidharta -- View this message in context: http://itk-users.7.n7.nabble.com/Extract-slice-from-ResampleFilter-tp38074p38110.html Sent from the ITK - 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 From francois.budin at kitware.com Thu Apr 13 09:06:39 2017 From: francois.budin at kitware.com (Francois Budin) Date: Thu, 13 Apr 2017 09:06:39 -0400 Subject: [ITK] [ITK-users] HistogramEqualization in ITK In-Reply-To: <1492086337666-38108.post@n7.nabble.com> References: <1492086337666-38108.post@n7.nabble.com> Message-ID: Hello Wang, One good way to explore the parameters to figure out which set gives you the result you want would be to write a short Python script: reader=itk.ImageFileReader[itk.Image[itk.UC,2]].New(FileName="/home/fbudin/Downloads/chest.png") myFilter=itk.AdaptiveHistogramEqualizationImageFilter.New(reader) for alpha in range(0,11): for beta in range(0,11): myFilter.SetAlpha(alpha*.1) myFilter.SetBeta(beta*.1) filename="/tmp/myFilter"+str(alpha)+"_"+str(beta)+".png" itk.ImageFileWriter.New(hm,FileName=filename).Update() I was not able to generate an image that looked exactly like the "opencv" image you sent, but that may be due to: -The implementation of this algorithm in OpenCV is different -The difference of the output is only due to different visualization parameters (Window/Level settings that are different for the different images). Hope this helps, Francois On Thu, Apr 13, 2017 at 8:25 AM, wangtaoiz wrote: > Dear all > I want to use itk::AdaptiveHistogramEqualizationImageFilter to do a > HistogramEqualization filter on a image as follow: > > So I set the parameters SetAlpha(0.5), SetBeta(0.5), the result is as > follow: > > but actually the result I want is showed as follow (which is generated by > opencv cvEqualizeHist() function): > > So I want to ask you if I can get that HistogramEqualization result by ITK? > > Thanks a lot > Wang > > > > -- > View this message in context: http://itk-users.7.n7.nabble. > com/HistogramEqualization-in-ITK-tp38108.html > Sent from the ITK - 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From francois.budin at kitware.com Thu Apr 13 09:12:23 2017 From: francois.budin at kitware.com (Francois Budin) Date: Thu, 13 Apr 2017 09:12:23 -0400 Subject: [ITK] [ITK-users] HistogramEqualization in ITK In-Reply-To: References: <1492086337666-38108.post@n7.nabble.com> Message-ID: Correction on the last line of what I sent: itk.ImageFileWriter.New(myFilter,FileName=filename).Update() On Thu, Apr 13, 2017 at 9:06 AM, Francois Budin wrote: > Hello Wang, > > One good way to explore the parameters to figure out which set gives you > the result you want would be to write a short Python script: > reader=itk.ImageFileReader[itk.Image[itk.UC,2]].New( > FileName="/home/fbudin/Downloads/chest.png") > myFilter=itk.AdaptiveHistogramEqualizationImageFilter.New(reader) > for alpha in range(0,11): > for beta in range(0,11): > myFilter.SetAlpha(alpha*.1) > myFilter.SetBeta(beta*.1) > filename="/tmp/myFilter"+str(alpha)+"_"+str(beta)+".png" > itk.ImageFileWriter.New(hm,FileName=filename).Update() > > I was not able to generate an image that looked exactly like the "opencv" > image you sent, but that may be due to: > -The implementation of this algorithm in OpenCV is different > -The difference of the output is only due to different visualization > parameters (Window/Level settings that are different for the different > images). > > Hope this helps, > Francois > > On Thu, Apr 13, 2017 at 8:25 AM, wangtaoiz wrote: > >> Dear all >> I want to use itk::AdaptiveHistogramEqualizationImageFilter to do a >> HistogramEqualization filter on a image as follow: >> > > >> So I set the parameters SetAlpha(0.5), SetBeta(0.5), the result is as >> follow: >> > > >> but actually the result I want is showed as follow (which is generated by >> opencv cvEqualizeHist() function): >> > > >> So I want to ask you if I can get that HistogramEqualization result by >> ITK? >> >> Thanks a lot >> Wang >> >> >> >> -- >> View this message in context: http://itk-users.7.n7.nabble.c >> om/HistogramEqualization-in-ITK-tp38108.html >> Sent from the ITK - 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 >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Thu Apr 13 10:37:12 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Thu, 13 Apr 2017 10:37:12 -0400 Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: <1492088644485-38110.post@n7.nabble.com> References: <1491482054290-38074.post@n7.nabble.com> <1491816595489-38084.post@n7.nabble.com> <1491926413097-38091.post@n7.nabble.com> <1491997495031-38097.post@n7.nabble.com> <1492088644485-38110.post@n7.nabble.com> Message-ID: Hi Sidartha, the code looks OK. The index is [0,0,0] by default, so just setting size is enough. My idea was not to apply translation2, then you would not have to set origin on the resample filter (it would start from [0,0,0]). I think you are forgetting to apply second translation, and you are not applying any transformation to the resample filter. Something like this is needed: filter->SetTransform(eulerTransform); What results are you getting? Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Thu, Apr 13, 2017 at 9:04 AM, sidharta wrote: > Hi D?enan, > > So I am doing something as follows: > > // Vectors for calculating normal_to_plane - The plane/slice I want to > extract > > Vector3d ST, SP, normal_to_plane; // This is a custom 3D Vector library > ST = traj_start - traj_end; // start and end of the trajectory - vector 1 > SP = traj_start - third_point; // start and third point gives another > vector > - vector 2 > // Now with two vectors I can get the direction of the normal to the plane > normal_to_plane = ST.cross(SP); // cross product essentially > > // Getting angles between normal to the plane and the coordinate axes > double angle_plane_z = std::acos((normal_to_plane[2] * 1) / > norm(normal_to_plane)); // angle between plane and z axis > double angle_plane_y = std::acos((normal_to_plane[1] * 1) / > norm(normal_to_plane)); // angle between plane and y axis > double angle_plane_x = std::acos((normal_to_plane[0] * 1) / > norm(normal_to_plane)); // angle between plane and x axis > > // Instantiate an Euler Transform > typedef itk::Euler3DTransform ETransformType; > ETransformType::Pointer eulerTransform = ETransformType::New(); > > // This because - Quote from ITKSoftwareGuide "Rotations are performed > around the origin of physical coordinates?not the image origin nor the > image > center" > ETransformType::OutputVectorType translation1; > translation1[0] = -origin_dcm[0]; // origin_dcm is the origin of the dicom > translation1[1] = -origin_dcm[1]; > translation1[2] = -origin_dcm[2]; > eulerTransform->Translate(translation1); > eulerTransform->SetRotation(angle_plane_x, angle_plane_y, angle_plane_z); > > // Get back to the origin of the dicom > ETransformType::OutputVectorType translation2; > translation2[0] = origin_dcm[0]; > translation2[1] = origin_dcm[1]; > translation2[2] = origin_dcm[2]; > > // Instantiate the ResampleFilter > // typedef double InternalPixelType; > // typedef itk::Image< InternalPixelType, Dimension > InternalImageType; // > For clarity > typedef itk::ResampleImageFilter > ResampleFilterType; > > ResampleFilterType::Pointer filter = ResampleFilterType::New(); > > typedef itk::NearestNeighborInterpolateImageFunction< > InternalImageType, double> InterpolatorType; > InterpolatorType::Pointer interpolator = InterpolatorType::New(); > filter->SetInterpolator(interpolator); > > filter->SetDefaultPixelValue(0); > filter->SetOutputSpacing(image->GetSpacing()); > filter->SetOutputOrigin(image->GetOrigin()); // If I change this to > traj_start, the dicom looks completely off, as in not intended. > filter->SetOutputDirection(image->GetDirection()); // I have my doubts > about > this too > filter->SetSize(image->GetSize()); // Of course, as you suggested, I would > set the thickness here as 1, but I was doing this for testing purposes. > filter->SetInput(image); > > So, what do you think about this code? Am I doing it correctly? I feel > really dumb asking you to check my code but unfortunately I can't find any > relevant example for 3D resampling. Additionally, (no offense) but I don't > get what you mean by "target region index" with respect to the resampling > filter? Do you mean the SetOrigin()? As you also see, I am essentially not > applying any translation to the origin. Just a rotation for testing > purposes. > > Thank you for your time. > Best Regards, > Sidharta > > > > > > -- > View this message in context: http://itk-users.7.n7.nabble. > com/Extract-slice-from-ResampleFilter-tp38074p38110.html > Sent from the ITK - 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Thu Apr 13 10:48:40 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Thu, 13 Apr 2017 10:48:40 -0400 Subject: [ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa) In-Reply-To: References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445968817@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445968862@MBX212.d.ethz.ch> Message-ID: Hi Fabio, the first error is coming from ITKCommonCastXML project, and the other first 1000 errors are also coming from*CastXML and *Swig projects. This means that the wrapping infrastructure is somehow triggering that bug in VS2017. The easiest thing to try is update CastXML, which Matt said would take care of. Let's see if that helps. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Wed, Apr 12, 2017 at 4:50 PM, D?enan Zuki? wrote: > Hi Fabio, > > it looks like we will have to wait somewhat until VS writers get around to > implement __builtin_offsetof > > > I don't know why it doesn't trigger when Python wrapping is OFF. I will > look into it more. > > Regards, > D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) > > On Wed, Apr 12, 2017 at 4:26 PM, Francois Budin < > francois.budin at kitware.com> wrote: > >> Fabio, >> >> To add a little bit of extra information about using BridgeNumpy: >> >> From NumPy to ITK, the memory is never copied, and always shared between >> the NumPy array and the ITK image. >> From ITK to NumPy, the memory is not copied at first, if the data is not >> changed from the NumPy side (e.g. if the ITK image is changed, the NumPy >> array will be modified too), but if you modify the NumPy array directly, >> NumPy will create a copy of the data. This also means that if you were to >> modify the NumPy array, the modifications would not be visible in the ITK >> image. >> >> A limited workaround to this is: >> >> # Get NumPy array from image >> arr_image = itk.GetArrayFromImage(image) >> # Create copy of array that can be modified in-place >> arr = arr_image.copy() >> # Modify array >> ? >> # Update image in-place with new array >> arr_image.setfield(arr,arr_image.dtype) >> >> The advantage of this method is that the image will be updated. However, >> there is an explicit copy of your data. >> If the copy step is skipped and the original NumPy array is modified, a >> copy of the data will be performed by NumPy and you may not be aware of it >> until you see that the data in the NumPy array and the image do not match >> anymore. >> >> Hope this helps, >> Francois >> >> On Wed, Apr 12, 2017 at 4:02 PM, D'Isidoro Fabio >> wrote: >> >>> Ok, thanks. Moe specifically I am using now *Visual Studio 2017 Preview* >>> . >>> >>> >>> >>> Fabio. >>> >>> *From:* D?enan Zuki? [mailto:dzenanz at gmail.com] >>> *Sent:* Mittwoch, 12. April 2017 21:54 >>> *To:* D'Isidoro Fabio >>> *Cc:* Matt McCormick ; insight-users at itk.org >>> >>> *Subject:* Re: [ITK-users] ITK Python: numpy to itk image (and >>> viceversa) >>> >>> >>> >>> Hi Fabio, >>> >>> >>> >>> let me give it a try with VS2017 and Wrapping+NumPy. I will report back >>> when I have an update. >>> >>> >>> >>> Regards, >>> >>> D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) >>> >>> >>> >>> On Wed, Apr 12, 2017 at 2:16 PM, D'Isidoro Fabio >>> wrote: >>> >>> Thank you. I am trying to build ITK Wrap Python with >>> Module_BridgeNumPy=ON with Visual Studio 2017. >>> >>> I get the following type of errors: >>> >>> 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/To >>> ols/MSVC/14.10.25017/include\xstring(1905,26): error G3F63BFAE: >>> constexpr variable '_Memcpy_move_offset' must be initialized by a constant >>> expression >>> 12> static constexpr size_t _Memcpy_move_offset = >>> offsetof(_Mydata_t, _Bx); >>> 12> ^ >>> ~~~~~~~~~~~~~~~~~~~~~~~~ >>> 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/To >>> ols/MSVC/14.10.25017/include\stdexcept:23:21: note: in instantiation of >>> template class 'std::basic_string, >>> std::allocator >' requested here >>> 12> : _Mybase(_Message.c_str()) >>> 12> ^ >>> 12>C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/To >>> ols/MSVC/14.10.25017/include\xstring:1905:48: note: cast that performs >>> the conversions of a reinterpret_cast is not allowed in a constant >>> expression >>> 12> static constexpr size_t _Memcpy_move_offset = >>> offsetof(_Mydata_t, _Bx); >>> 12> ^ >>> 12>C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0/ucrt\stddef.h:38:32: >>> note: expanded from macro 'offsetof' >>> 12> #define offsetof(s,m) ((size_t)&reinterpret_cast>> volatile&>((((s*)0)->m))) >>> >>> >>> The build worked with Visual Studio 2015 instead. >>> >>> Can I fix this issue with Visual Studio 2017 somehow? >>> >>> Thank you. >>> >>> ---------------------------------------------------------------------- >>> Fabio D?Isidoro - PhD Student >>> Institute of Biomechanics >>> HPP O 14 >>> H?nggerbergring 64 >>> 8093 Z?rich, Switzerland >>> >>> >>> -----Original Message----- >>> From: Matt McCormick [mailto:matt.mccormick at kitware.com] >>> Sent: Montag, 3. April 2017 20:41 >>> To: D'Isidoro Fabio >>> Cc: insight-users at itk.org >>> Subject: Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) >>> >>> Hallo Fabio, >>> >>> >>> > I use ITK with Python Wrap. I need to interface my Python code with a >>> > Cython-wrapped C++ code that takes only numpy array as input and >>> > returns numpy array as output. >>> >>> Cool. By the way, you may be interested in scikit-build [1], which is a >>> good way to build Cython-wrapped C++ code. We are using it for the ITK and >>> SimpleITK Python packages, and it has good Cython and CMake support. >>> >>> >>> > Hence, I need to convert the Python itk images into numpy array to be >>> > given as input to the wrapped C++ code, and then convert the numpy >>> > array in output from the wrapped C++ code back into python itk images. >>> > >>> > >>> > >>> > Question 1) How can I do that in an efficient way? I found some posts >>> > on itk.PyBuffer but I could not find anywhere any reference on how to >>> > install it on my itk wrap build. >>> >>> Yes, itk.PyBuffer works great for that. Please review a PR for some >>> additional documentation: >>> >>> https://github.com/InsightSoftwareConsortium/ITKBridgeNumPy/pull/18 >>> >>> This has been available in ITK for a few releases as a Remote module, >>> which can be enabled by setting >>> >>> Module_BridgeNumPy=ON >>> >>> in ITK's CMake configuration. >>> >>> >>> Since ITK 4.11.0, it is easier to build since it does not require the >>> NumPy headers. >>> >>> >>> In current ITK Git master (to be 4.12.0) the module is enabled by >>> default. >>> >>> >>> Nightly ITK Python packages for ITK Git master are now being built: >>> >>> https://github.com/InsightSoftwareConsortium/ITKPythonPackage >>> >>> macOS and Linux are available. Windows packages will be available over >>> the coming weeks. >>> >>> >>> >>> > Question 2) The purpose of writing a part of my algorithm in C++ is to >>> > speed up the code. If the conversion between python itk images and >>> > numpy arrays is slow, I would lose all the speed gain obtained with >>> the C++ implementation. >>> > Are there better ways to deal with that? >>> >>> The newer versions ITKBridgeNumPy use a NumPy array view, which does not >>> do any copies during the conversion, and it is very fast. >>> >>> >>> HTH, >>> Matt >>> >>> >>> [1] http://scikit-build.org/ >>> _____________________________________ >>> 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 >>> >>> >>> >>> _____________________________________ >>> 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 >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From sidharta.gupta93 at gmail.com Thu Apr 13 11:01:24 2017 From: sidharta.gupta93 at gmail.com (sidharta) Date: Thu, 13 Apr 2017 08:01:24 -0700 (MST) Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: References: <1491482054290-38074.post@n7.nabble.com> <1491816595489-38084.post@n7.nabble.com> <1491926413097-38091.post@n7.nabble.com> <1491997495031-38097.post@n7.nabble.com> <1492088644485-38110.post@n7.nabble.com> Message-ID: <1492095684045-38115.post@n7.nabble.com> Hi D?enan, Sorry about that, I missed the line in the post. I am, in fact, adding that line filter->SetTransform(). Apologies, but I don't know how I can share .dcm/.mhd image. I am just going to add the desirable which I did using Amira, which is where I got the idea of using EulerTransform. . The big sphere is the third point and the two small ones are the start and end of the trajectory. The slices on the bounding box are essentially on the origin. So, with vector math I could get the equation of the plane and so forth. If you want to see the output .dcm, kindly let me know how I can share it with you ( from a cloud probably but I don't know what you prefer). Thank you for your swift reply and patience. Regards, Sidharta -- View this message in context: http://itk-users.7.n7.nabble.com/Extract-slice-from-ResampleFilter-tp38074p38115.html Sent from the ITK - 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 From dzenanz at gmail.com Thu Apr 13 11:13:32 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Thu, 13 Apr 2017 11:13:32 -0400 Subject: [ITK] [ITK-users] Rotating image results in last slices being half empty In-Reply-To: <1491689302258-38081.post@n7.nabble.com> References: <1491689302258-38081.post@n7.nabble.com> Message-ID: Hi Matias, you are not using origenX or origenY after they are defined. But your program (with modifications to make it compile) works for me: [image: Inline image 1] Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Sat, Apr 8, 2017 at 6:08 PM, Matias wrote: > Hi, I'm rotating a volume (Using the Euler3DTransform) and the final set > of slices are half black or empty. here's an example when rotating a volume > of 10 slices: Am I missing something such as changing the origin or maybe > computing the center incorrectly? (The center is passed as parameter from > another program) And here's the code I'm using: typedef > itk::ResampleImageFilter FilterType; > FilterType::Pointer FiltroResample = FilterType::New(); > FiltroResample->SetInput(reader->GetOutput()); typedef itk:: > LinearInterpolateImageFunction InterpolatorType; > InterpolatorType::Pointer interpolator = InterpolatorType::New(); > FiltroResample->SetInterpolator(interpolator); FiltroResample-> > SetOutputDirection(inputImage->GetDirection()); FiltroResample-> > SetOutputOrigin(inputImage->GetOrigin()); ImageType::SizeType inputSize = > inputImage->GetLargestPossibleRegion().GetSize(); FiltroResample->SetSize(inputSize); > const ImageType::SpacingType& inputSpacing = inputImage->GetSpacing(); > FiltroResample->SetOutputSpacing(inputSpacing); FiltroResample->SetDefaultPixelValue(-1000); > typedef itk::Euler3DTransform< double > TransformType; //Transform > TransformType::Pointer transform = TransformType::New(); double alfa, beta, > gamma, centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z, > origenX,origenY; gamma = atof(argv[2]); beta = atof(argv[3]); alfa = > atof(argv[4]); centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = > atof(argv[6]); centro_rotacion_Z = atof(argv[7]); origenX = atof(argv[8]); > origenY = atof(argv[9]); transform->SetRotation(gamma, beta, alfa); double > centro[3] = { centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z }; > transform->SetCenter(centro); FiltroResample->SetTransform(transform); > FiltroResample->Update(); > ------------------------------ > View this message in context: Rotating image results in last slices being > half empty > > Sent from the ITK - 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screenshot 2017-04-13 11.09.11.jpg Type: image/jpeg Size: 45704 bytes Desc: not available URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Thu Apr 13 11:16:23 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Thu, 13 Apr 2017 11:16:23 -0400 Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: <1492095684045-38115.post@n7.nabble.com> References: <1491482054290-38074.post@n7.nabble.com> <1491816595489-38084.post@n7.nabble.com> <1491926413097-38091.post@n7.nabble.com> <1491997495031-38097.post@n7.nabble.com> <1492088644485-38110.post@n7.nabble.com> <1492095684045-38115.post@n7.nabble.com> Message-ID: ?Hi Siddartha, you can share using cloud tools, e.g. Dropbox or Google Drive. But I think you forgot to ask the question: I don't know what you are asking. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.)? On Thu, Apr 13, 2017 at 11:01 AM, sidharta wrote: > Hi D?enan, > > Sorry about that, I missed the line in the post. I am, in fact, adding that > line filter->SetTransform(). > > Apologies, but I don't know how I can share .dcm/.mhd image. I am just > going > to add the desirable which I did using Amira, which is where I got the idea > of using EulerTransform. > . The big > sphere > is the third point and the two small ones are the start and end of the > trajectory. The slices on the bounding box are essentially on the origin. > So, with vector math I could get the equation of the plane and so forth. If > you want to see the output .dcm, kindly let me know how I can share it with > you ( from a cloud probably but I don't know what you prefer). > > Thank you for your swift reply and patience. > > Regards, > Sidharta > > > > -- > View this message in context: http://itk-users.7.n7.nabble. > com/Extract-slice-from-ResampleFilter-tp38074p38115.html > Sent from the ITK - 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From sidharta.gupta93 at gmail.com Thu Apr 13 11:33:52 2017 From: sidharta.gupta93 at gmail.com (sidharta) Date: Thu, 13 Apr 2017 08:33:52 -0700 (MST) Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: References: <1491816595489-38084.post@n7.nabble.com> <1491926413097-38091.post@n7.nabble.com> <1491997495031-38097.post@n7.nabble.com> <1492088644485-38110.post@n7.nabble.com> <1492095684045-38115.post@n7.nabble.com> Message-ID: <1492097632375-38118.post@n7.nabble.com> So if you think the code is correct and is doing what you suggested (or what I think it should do using the eulerTransform), you mentioned setting targetRegionIndex in ResampleFilter to get one single slice. I don't see this targetRegionIndex or do you mean set origin. I am going to send you the link to the dropbox folder in a private mail. -- View this message in context: http://itk-users.7.n7.nabble.com/Extract-slice-from-ResampleFilter-tp38074p38118.html Sent from the ITK - 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 From dzenanz at gmail.com Thu Apr 13 13:44:58 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Thu, 13 Apr 2017 13:44:58 -0400 Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: <1492097632375-38118.post@n7.nabble.com> References: <1491816595489-38084.post@n7.nabble.com> <1491926413097-38091.post@n7.nabble.com> <1491997495031-38097.post@n7.nabble.com> <1492088644485-38110.post@n7.nabble.com> <1492095684045-38115.post@n7.nabble.com> <1492097632375-38118.post@n7.nabble.com> Message-ID: The target region is the region (index and size) you set in the resample filter. It is just a difference in terminology between you and me. I took a look at the images you supplied. Because of transformations, this is hard to debug. I realized it would be easier to construct the output image to be in the same physical space as the input image, and have identity transform applied to resample filter (used by default). Pseudo-code: ImageType::DirectionType dir; ST.normalize(); dir[0]=ST; //vector from first point to second vec3 second=normal.cross(ST); //make the second vector orthogonal to first and the normal second.normalize(); dir[1]=second; normal.normalize(); dir[2]=normal; filter->SetOutputDirection(dir); filter->SetOrigin(traj_start); //it will be more math to compute proper size (so that resampled image ends at traj_end), and proper spacing (project original spacing onto coordinate system established by new dir matrix or use isotropic spacing equal to cubic root of sp[0]*sp[1]*sp[2]). With this approach you can use e.g. Slicer to look at both the original and resampled images, and also define fiducial points for your 3 points of interest. P.S. If you share any more images, please save them with compression applied (writer->SetUseCompression(true);). Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Thu, Apr 13, 2017 at 11:33 AM, sidharta wrote: > So if you think the code is correct and is doing what you suggested (or > what > I think it should do using the eulerTransform), you mentioned setting > targetRegionIndex in ResampleFilter to get one single slice. I don't see > this targetRegionIndex or do you mean set origin. I am going to send you > the > link to the dropbox folder in a private mail. > > > > -- > View this message in context: http://itk-users.7.n7.nabble. > com/Extract-slice-from-ResampleFilter-tp38074p38118.html > Sent from the ITK - 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From jonathan.lefman at intel.com Thu Apr 13 15:00:12 2017 From: jonathan.lefman at intel.com (Lefman, Jonathan) Date: Thu, 13 Apr 2017 19:00:12 +0000 Subject: [ITK] [ITK-dev] Update on cmake support for TBB Message-ID: Hi all, I recently caught up with Intel's TBB team. There is good news regarding better support for cmake and TBB. Sometime soon, there will likely be a release of TBB to support this need. I will send an update when I have more specific details to pass along. -Jon _______________________________________________ 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://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-developers From dzenanz at gmail.com Thu Apr 13 15:59:20 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Thu, 13 Apr 2017 15:59:20 -0400 Subject: [ITK] [ITK-dev] Update on cmake support for TBB In-Reply-To: References: Message-ID: Hi Jonathan, that is great to hear! Is there any news on adding ITK to Intel compiler's regression test suite? Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Thu, Apr 13, 2017 at 3:00 PM, Lefman, Jonathan wrote: > Hi all, > > I recently caught up with Intel's TBB team. There is good news regarding > better support for cmake and TBB. Sometime soon, there will likely be a > release of TBB to support this need. I will send an update when I have more > specific details to pass along. > > -Jon > _______________________________________________ > 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://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-developers > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _______________________________________________ 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://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-developers From jonathan.lefman at intel.com Thu Apr 13 16:01:36 2017 From: jonathan.lefman at intel.com (Lefman, Jonathan) Date: Thu, 13 Apr 2017 20:01:36 +0000 Subject: [ITK] [ITK-dev] Update on cmake support for TBB In-Reply-To: References: Message-ID: I can tell you that I?m working on it to get that pushed through. Making progress, but I do not yet have a definitive answer. Will update as soon as I am able. -Jon From: D?enan Zuki? [mailto:dzenanz at gmail.com] Sent: Thursday, April 13, 2017 3:59 PM To: Lefman, Jonathan Cc: insight-developers at itk.org Subject: Re: [ITK-dev] Update on cmake support for TBB Hi Jonathan, that is great to hear! Is there any news on adding ITK to Intel compiler's regression test suite? Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Thu, Apr 13, 2017 at 3:00 PM, Lefman, Jonathan > wrote: Hi all, I recently caught up with Intel's TBB team. There is good news regarding better support for cmake and TBB. Sometime soon, there will likely be a release of TBB to support this need. I will send an update when I have more specific details to pass along. -Jon _______________________________________________ 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://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-developers -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _______________________________________________ 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://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-developers From blowekamp at mail.nih.gov Fri Apr 14 11:55:40 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Fri, 14 Apr 2017 15:55:40 +0000 Subject: [ITK] [ANN] SimpleITK 1.0.0 Release Message-ID: <3A9B6734-7719-4069-8E7B-E0F1B35A0A5F@mail.nih.gov> The SimpleITK Development Team and the Insight Software Consortium are proud to announce the first major release of SimpleITK. SimpleITK is a simplified multi-language interface to the National Library of Medicine?s Insight Segmentation and Registration Toolkit (ITK). Providing an easy to use interface to ITK. SimpleITK is intended to broaden the use of ITK to researchers and domain scientist who are novice software developers, enabling them to benefit from the image-analysis power of ITK. For experienced software developers, the toolkit enables rapid prototyping of image segmentation and registration frameworks and facilitates evaluation of the effects algorithmic parameter settings have on results with minimal programming effort. In the educational setting SimpleITK's concise interface allows students to experiment with well known algorithms, enhancing their understanding of algorithm performance without the need for advanced software engineering skills. The toolkit development process follows best software engineering practices including code reviews and continuous integration testing, with results displayed online allowing everyone to gauge the status of the current code and any code that is under consideration for incorporation into the toolkit. User support is available through a dedicated mailing list and the project?s Wiki. SimpleITK is available for the following programing languages: Python, R, Java, C#, C++, Lua, Ruby, and TCL. Binary versions of the toolkit are available for the GNU Linux, Apple OS X, and Microsoft Windows operating systems. All of the source code is freely available on github under an Apache-2.0 license. Downloading SimpleITK Complete instructions on getting started with SimpleITK including downloading binaries or building SimpleITK can be found on the SimpleITK Wiki (https://itk.org/Wiki/SimpleITK/GettingStarted). - Python Binary Downloads - Python binary wheels are available for download. It is important to have the latest version of pip to ensure correct wheel compatibility and installation. To install the latest SimpleITK package form PyPI: ``` pip install --upgrade pip pip install SimpleITK ``` - Many Conda package have been upload to Anaconda Cloud on the `SimpleITK`. These can be installed with: ``` conda install -c simpleitk simpleitk ``` - A complete available set of compiled binaries, including select CSharp and Java distributions, along with source and data tar-balls are available on Source Forge (https://sourceforge.net/projects/simpleitk/files/SimpleITK/1.0.0/). Release Notes - Key Improvements: - Improved Python data bridge - New Python method `GetArrayViewFromImage` provides copy free read-only access - Updated Python data structures to use `memory view` objects - New language specific building SimpleITK front-ends - R devtools based installer (https://github.com/SimpleITK/SimpleITKRInstaller). - Python: scripts for building wheels (https://github.com/SimpleITK/SimpleITKPythonPackage) and a Conda recipe (https://github.com/SimpleITK/SimpleITKCondaRecipe). - Improved writing DICOM tags when writing a slice, and disabled writing a DICOM series with the ImageSeriesWriter - Support use of virtual image domain in the `ImageRegistrationMethod` - OnePlusOneOptimizer added to registration framework - Improved support for R: propogating C++ exceptions into R, additional R tests - Additional tests for Java - Python and R notebooks repository illustrating the basics and more advanced functionality of SimpleITK (https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks) - Added continous integration via CircleCI - Updated version and improved integration of Google Test - Updated ITK version to 4.11.0+ - Updated minimal required CMake version to 3.0, and numerous CMake changes to support various build configurations - Fix, "pip install" works for Apple Mac OS X. - Updated to usage of SWIG 3.0.11 ( using the latest SIWG is strongly recommended for R ) - Reorganized examples directory into example based sub-directories with multiple languages - Improvements to documentation transmogrification scripts - Many bug fixes and improvement to the build system! - Additional Improvements: - Added multi-hash ExternalData support for sha512 - Added R Documentation files - Update Python and Java documentation strings files - Fix allowing undefined symbols when building standalone language wrapping - Reorganized examples directory - Reorganized filter libraries to match ITK modules - Improved compilation with more specific ITK module usage - Now using modern CMake 3 style properties for exported libraries - API Changes - Replaced return Self with void for wrapped languages, to address memory and segmentation fault issue. - Depricated CMake variables with "SITK" prefix, now consistenly using the "SimpleITK" prefix for configurable CMake variables - Removed `ImageSeriesReader::GetGDCMSeriesFileNames` parameter `loadPrivateTags` parameter. This removes an overloaded version of the class method. - Added `sitkWallClock` enum for a sentinel value for random number seed to indicate initialization from the clock - New method `Image::GetNumberOfPixels` - New method `LabelMapContourOverlayImageFilter::SetColormap` - New method `LabelMapToRGBImageFilter::SetColormap` - New method `ImageRegistrationMethod::SetVirtualDomain` - New method `ImageRegistrationMethod::SetVirtualDomainFromImage` - New seed parameter to `ImageRegistrationMethod::AddMetricSamplingSeed` method - `CastImageFilter::SetOutputPixelType` method no longer accepts the pixel ID by value, uses only enumerated type Enjoy! Bradley Lowekamp -------------- next part -------------- An HTML attachment was scrubbed... URL: From matimontg at gmail.com Fri Apr 14 12:26:37 2017 From: matimontg at gmail.com (Matias) Date: Fri, 14 Apr 2017 09:26:37 -0700 (MST) Subject: [ITK] [ITK-users] Rotating image results in last slices being half empty In-Reply-To: References: <1491689302258-38081.post@n7.nabble.com> Message-ID: Thanks Dzenan. I actually use OrigenX and OrigenY to assign it to the DCM tags. Just curious, how did you compile to use with Slicer? El jue., 13 de abr. de 2017 a la(s) 12:14, D?enan Zuki? [via ITK - Users] < ml-node+s7n38116h65 at n7.nabble.com> escribi?: > Hi Matias, > > you are not using origenX or origenY after they are defined. But your > program (with modifications to make it compile) works for me: > [image: Inline image 1] > > Regards, > D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) > > On Sat, Apr 8, 2017 at 6:08 PM, Matias <[hidden email] > > wrote: > >> Hi, I'm rotating a volume (Using the Euler3DTransform) and the final set >> of slices are half black or empty. here's an example when rotating a volume >> of 10 slices: Am I missing something such as changing the origin or maybe >> computing the center incorrectly? (The center is passed as parameter from >> another program) And here's the code I'm using: typedef >> itk::ResampleImageFilter FilterType; >> FilterType::Pointer FiltroResample = FilterType::New(); >> FiltroResample->SetInput(reader->GetOutput()); typedef >> itk::LinearInterpolateImageFunction InterpolatorType; >> InterpolatorType::Pointer interpolator = InterpolatorType::New(); >> FiltroResample->SetInterpolator(interpolator); >> FiltroResample->SetOutputDirection(inputImage->GetDirection()); >> FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); >> ImageType::SizeType inputSize = >> inputImage->GetLargestPossibleRegion().GetSize(); >> FiltroResample->SetSize(inputSize); const ImageType::SpacingType& >> inputSpacing = inputImage->GetSpacing(); >> FiltroResample->SetOutputSpacing(inputSpacing); >> FiltroResample->SetDefaultPixelValue(-1000); typedef itk::Euler3DTransform< >> double > TransformType; //Transform TransformType::Pointer transform = >> TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, >> centro_rotacion_Y, centro_rotacion_Z, origenX,origenY; gamma = >> atof(argv[2]); beta = atof(argv[3]); alfa = atof(argv[4]); >> centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = atof(argv[6]); >> centro_rotacion_Z = atof(argv[7]); origenX = atof(argv[8]); origenY = >> atof(argv[9]); transform->SetRotation(gamma, beta, alfa); double centro[3] >> = { centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z }; >> transform->SetCenter(centro); FiltroResample->SetTransform(transform); >> FiltroResample->Update(); >> ------------------------------ >> View this message in context: Rotating image results in last slices >> being half empty >> >> Sent from the ITK - 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 >> >> > > _____________________________________ > 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 > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://itk-users.7.n7.nabble.com/Rotating-image-results-in-last-slices-being-half-empty-tp38081p38116.html > To unsubscribe from Rotating image results in last slices being half > empty, click here > > . > NAML > > -- Matias -- View this message in context: http://itk-users.7.n7.nabble.com/Rotating-image-results-in-last-slices-being-half-empty-tp38081p38121.html Sent from the ITK - Users mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Fri Apr 14 13:15:49 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Fri, 14 Apr 2017 13:15:49 -0400 Subject: [ITK] [ITK-users] Rotating image results in last slices being half empty In-Reply-To: References: <1491689302258-38081.post@n7.nabble.com> Message-ID: Hi Matias, I didn't compile to use with Slicer. I only open the input and output image in Slicer to visualize them. But making a Slicer CLI module is fairly easy. You can take a look at one of the existing modules, docs including extension wizard . Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Fri, Apr 14, 2017 at 12:26 PM, Matias wrote: > Thanks Dzenan. I actually use OrigenX and OrigenY to assign it to the DCM > tags. Just curious, how did you compile to use with Slicer? > > El jue., 13 de abr. de 2017 a la(s) 12:14, D?enan Zuki? [via ITK - Users] <[hidden > email] > escribi?: > >> Hi Matias, >> >> you are not using origenX or origenY after they are defined. But your >> program (with modifications to make it compile) works for me: >> [image: Inline image 1] >> >> Regards, >> D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) >> >> On Sat, Apr 8, 2017 at 6:08 PM, Matias <[hidden email] >> > wrote: >> Hi, I'm rotating a volume (Using the Euler3DTransform) and the final set >> of slices are half black or empty. here's an example when rotating a volume >> of 10 slices: Am I missing something such as changing the origin or maybe >> computing the center incorrectly? (The center is passed as parameter from >> another program) And here's the code I'm using: typedef >> itk::ResampleImageFilter FilterType; >> FilterType::Pointer FiltroResample = FilterType::New(); >> FiltroResample->SetInput(reader->GetOutput()); typedef itk:: >> LinearInterpolateImageFunction InterpolatorType; >> InterpolatorType::Pointer interpolator = InterpolatorType::New(); >> FiltroResample->SetInterpolator(interpolator); FiltroResample-> >> SetOutputDirection(inputImage->GetDirection()); FiltroResample-> >> SetOutputOrigin(inputImage->GetOrigin()); ImageType::SizeType inputSize >> = inputImage->GetLargestPossibleRegion().GetSize(); >> FiltroResample->SetSize(inputSize); const ImageType::SpacingType& >> inputSpacing = inputImage->GetSpacing(); FiltroResample-> >> SetOutputSpacing(inputSpacing); FiltroResample->SetDefaultPixelValue(-1000); >> typedef itk::Euler3DTransform< double > TransformType; //Transform >> TransformType::Pointer transform = TransformType::New(); double alfa, beta, >> gamma, centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z, >> origenX,origenY; gamma = atof(argv[2]); beta = atof(argv[3]); alfa = >> atof(argv[4]); centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = >> atof(argv[6]); centro_rotacion_Z = atof(argv[7]); origenX = atof(argv[8]); >> origenY = atof(argv[9]); transform->SetRotation(gamma, beta, alfa); double >> centro[3] = { centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z }; >> transform->SetCenter(centro); FiltroResample->SetTransform(transform); >> FiltroResample->Update(); >> ------------------------------ >> View this message in context: Rotating image results in last slices >> being half empty >> >> Sent from the ITK - 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 >> >> > > _____________________________________ > 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 > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > http://itk-users.7.n7.nabble.com/Rotating-image-results-in- > last-slices-being-half-empty-tp38081p38116.html > To unsubscribe from Rotating image results in last slices being half > empty, click here. > NAML > > -- > Matias > > ------------------------------ > View this message in context: Re: [ITK-users] Rotating image results in > last slices being half empty > > > Sent from the ITK - 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Fri Apr 14 13:16:53 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Fri, 14 Apr 2017 13:16:53 -0400 Subject: [ITK] [ITK-users] Rotating image results in last slices being half empty In-Reply-To: References: <1491689302258-38081.post@n7.nabble.com> Message-ID: Here is the code I used: #include #include #include #include template< typename TImage > itk::SmartPointer ReadImage(const char *filename) { typedef itk::ImageFileReader ReaderType; typename ReaderType::Pointer r = ReaderType::New(); r->SetFileName(filename); r->Update(); return r->GetOutput(); } template< typename TImage > void WriteImage(itk::SmartPointer out, const char *filename) { typedef itk::ImageFileWriter WriterType; typename WriterType::Pointer w = WriterType::New(); w->SetInput(out); w->SetFileName(filename); //w->SetUseCompression(true); w->Update(); } int main(int argc, char *argv[]) { const unsigned int dimension = 3; typedef itk::Image ImageType; ImageType::Pointer inputImage = ReadImage("C:/CBCT.nrrd"); typedef itk::ResampleImageFilter FilterType; FilterType::Pointer FiltroResample = FilterType::New(); FiltroResample->SetInput(inputImage); typedef itk::LinearInterpolateImageFunction InterpolatorType; InterpolatorType::Pointer interpolator = InterpolatorType::New(); FiltroResample->SetInterpolator(interpolator); FiltroResample->SetOutputDirection(inputImage->GetDirection()); FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); ImageType::SizeType inputSize = inputImage->GetLargestPossibleRegion().GetSize(); FiltroResample->SetSize(inputSize); const ImageType::SpacingType& inputSpacing = inputImage->GetSpacing(); FiltroResample->SetOutputSpacing(inputSpacing); FiltroResample->SetDefaultPixelValue(-1000); typedef itk::Euler3DTransform TransformType; TransformType::Pointer transform = TransformType::New(); transform->SetRotation(0.2, 0.3, 0.5); double centro[3] = { 10,20,30 }; transform->SetCenter(centro); FiltroResample->SetTransform(transform); FiltroResample->Update(); WriteImage(FiltroResample->GetOutput(), "C:/cbctResampled.nrrd"); } On Fri, Apr 14, 2017 at 1:15 PM, D?enan Zuki? wrote: > Hi Matias, > > I didn't compile to use with Slicer. I only open the input and output > image in Slicer to visualize them. > > But making a Slicer CLI module is fairly easy. You can take a look at one > > of the existing modules, docs > including > extension wizard > > . > > Regards, > D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) > > On Fri, Apr 14, 2017 at 12:26 PM, Matias wrote: > >> Thanks Dzenan. I actually use OrigenX and OrigenY to assign it to the DCM >> tags. Just curious, how did you compile to use with Slicer? >> >> El jue., 13 de abr. de 2017 a la(s) 12:14, D?enan Zuki? [via ITK - Users] >> <[hidden email] > >> escribi?: >> >>> Hi Matias, >>> >>> you are not using origenX or origenY after they are defined. But your >>> program (with modifications to make it compile) works for me: >>> [image: Inline image 1] >>> >>> Regards, >>> D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) >>> >>> On Sat, Apr 8, 2017 at 6:08 PM, Matias <[hidden email] >>> > wrote: >>> Hi, I'm rotating a volume (Using the Euler3DTransform) and the final set >>> of slices are half black or empty. here's an example when rotating a volume >>> of 10 slices: Am I missing something such as changing the origin or maybe >>> computing the center incorrectly? (The center is passed as parameter from >>> another program) And here's the code I'm using: typedef >>> itk::ResampleImageFilter FilterType; >>> FilterType::Pointer FiltroResample = FilterType::New(); >>> FiltroResample->SetInput(reader->GetOutput()); typedef >>> itk::LinearInterpolateImageFunction >>> InterpolatorType; InterpolatorType::Pointer interpolator = >>> InterpolatorType::New(); FiltroResample->SetInterpolator(interpolator); >>> FiltroResample->SetOutputDirection(inputImage->GetDirection()); >>> FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); >>> ImageType::SizeType inputSize = inputImage->GetLargestPossibleRegion().GetSize(); >>> FiltroResample->SetSize(inputSize); const ImageType::SpacingType& >>> inputSpacing = inputImage->GetSpacing(); FiltroResample->SetOutputSpacing(inputSpacing); >>> FiltroResample->SetDefaultPixelValue(-1000); typedef >>> itk::Euler3DTransform< double > TransformType; //Transform >>> TransformType::Pointer transform = TransformType::New(); double alfa, beta, >>> gamma, centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z, >>> origenX,origenY; gamma = atof(argv[2]); beta = atof(argv[3]); alfa = >>> atof(argv[4]); centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = >>> atof(argv[6]); centro_rotacion_Z = atof(argv[7]); origenX = atof(argv[8]); >>> origenY = atof(argv[9]); transform->SetRotation(gamma, beta, alfa); double >>> centro[3] = { centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z }; >>> transform->SetCenter(centro); FiltroResample->SetTransform(transform); >>> FiltroResample->Update(); >>> ------------------------------ >>> View this message in context: Rotating image results in last slices >>> being half empty >>> >>> Sent from the ITK - 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 >>> >>> >> >> _____________________________________ >> 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 >> >> >> ------------------------------ >> If you reply to this email, your message will be added to the discussion >> below: >> http://itk-users.7.n7.nabble.com/Rotating-image-results-in-l >> ast-slices-being-half-empty-tp38081p38116.html >> To unsubscribe from Rotating image results in last slices being half >> empty, click here. >> NAML >> >> -- >> Matias >> >> ------------------------------ >> View this message in context: Re: [ITK-users] Rotating image results in >> last slices being half empty >> >> >> Sent from the ITK - 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 >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matimontg at gmail.com Sat Apr 15 10:27:45 2017 From: matimontg at gmail.com (Matias Montroull) Date: Sat, 15 Apr 2017 11:27:45 -0300 Subject: [ITK] [ITK-users] Rotating image results in last slices being half empty In-Reply-To: References: <1491689302258-38081.post@n7.nabble.com> Message-ID: Dzenan, The center of rotation is set to use milimeters or image coordinates? Thanks Matias On Apr 14, 2017 2:17 PM, "D?enan Zuki?" wrote: > Here is the code I used: > > #include > #include > #include > #include > > template< typename TImage > > itk::SmartPointer ReadImage(const char *filename) > { > typedef itk::ImageFileReader ReaderType; > typename ReaderType::Pointer r = ReaderType::New(); > r->SetFileName(filename); > r->Update(); > return r->GetOutput(); > } > > template< typename TImage > > void WriteImage(itk::SmartPointer out, const char *filename) > { > typedef itk::ImageFileWriter WriterType; > typename WriterType::Pointer w = WriterType::New(); > w->SetInput(out); > w->SetFileName(filename); > //w->SetUseCompression(true); > w->Update(); > } > > int main(int argc, char *argv[]) > { > const unsigned int dimension = 3; > typedef itk::Image ImageType; > ImageType::Pointer inputImage = ReadImage("C:/CBCT.nrrd"); > > typedef itk::ResampleImageFilter FilterType; > FilterType::Pointer FiltroResample = FilterType::New(); > FiltroResample->SetInput(inputImage); > typedef itk::LinearInterpolateImageFunction > InterpolatorType; > InterpolatorType::Pointer interpolator = InterpolatorType::New(); > FiltroResample->SetInterpolator(interpolator); > FiltroResample->SetOutputDirection(inputImage->GetDirection()); > FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); > ImageType::SizeType inputSize = inputImage-> > GetLargestPossibleRegion().GetSize(); > FiltroResample->SetSize(inputSize); > const ImageType::SpacingType& inputSpacing = inputImage->GetSpacing(); > FiltroResample->SetOutputSpacing(inputSpacing); > FiltroResample->SetDefaultPixelValue(-1000); > typedef itk::Euler3DTransform TransformType; > TransformType::Pointer transform = TransformType::New(); > transform->SetRotation(0.2, 0.3, 0.5); > double centro[3] = { 10,20,30 }; > transform->SetCenter(centro); > FiltroResample->SetTransform(transform); > FiltroResample->Update(); > WriteImage(FiltroResample->GetOutput(), > "C:/cbctResampled.nrrd"); > } > > On Fri, Apr 14, 2017 at 1:15 PM, D?enan Zuki? wrote: > >> Hi Matias, >> >> I didn't compile to use with Slicer. I only open the input and output >> image in Slicer to visualize them. >> >> But making a Slicer CLI module is fairly easy. You can take a look at one >> >> of the existing modules, docs >> including >> extension wizard >> >> . >> >> Regards, >> D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) >> >> On Fri, Apr 14, 2017 at 12:26 PM, Matias wrote: >> >>> Thanks Dzenan. I actually use OrigenX and OrigenY to assign it to the >>> DCM tags. Just curious, how did you compile to use with Slicer? >>> >>> El jue., 13 de abr. de 2017 a la(s) 12:14, D?enan Zuki? [via ITK - >>> Users] <[hidden email] >>> > escribi?: >>> >>>> Hi Matias, >>>> >>>> you are not using origenX or origenY after they are defined. But your >>>> program (with modifications to make it compile) works for me: >>>> [image: Inline image 1] >>>> >>>> Regards, >>>> D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) >>>> >>>> On Sat, Apr 8, 2017 at 6:08 PM, Matias <[hidden email] >>>> > wrote: >>>> Hi, I'm rotating a volume (Using the Euler3DTransform) and the final >>>> set of slices are half black or empty. here's an example when rotating a >>>> volume of 10 slices: Am I missing something such as changing the origin or >>>> maybe computing the center incorrectly? (The center is passed as parameter >>>> from another program) And here's the code I'm using: typedef >>>> itk::ResampleImageFilter FilterType; >>>> FilterType::Pointer FiltroResample = FilterType::New(); >>>> FiltroResample->SetInput(reader->GetOutput()); typedef >>>> itk::LinearInterpolateImageFunction >>>> InterpolatorType; InterpolatorType::Pointer interpolator = >>>> InterpolatorType::New(); FiltroResample->SetInterpolator(interpolator); >>>> FiltroResample->SetOutputDirection(inputImage->GetDirection()); >>>> FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); >>>> ImageType::SizeType inputSize = inputImage->GetLargestPossibleRegion().GetSize(); >>>> FiltroResample->SetSize(inputSize); const ImageType::SpacingType& >>>> inputSpacing = inputImage->GetSpacing(); FiltroResample->SetOutputSpacing(inputSpacing); >>>> FiltroResample->SetDefaultPixelValue(-1000); typedef >>>> itk::Euler3DTransform< double > TransformType; //Transform >>>> TransformType::Pointer transform = TransformType::New(); double alfa, beta, >>>> gamma, centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z, >>>> origenX,origenY; gamma = atof(argv[2]); beta = atof(argv[3]); alfa = >>>> atof(argv[4]); centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = >>>> atof(argv[6]); centro_rotacion_Z = atof(argv[7]); origenX = atof(argv[8]); >>>> origenY = atof(argv[9]); transform->SetRotation(gamma, beta, alfa); double >>>> centro[3] = { centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z }; >>>> transform->SetCenter(centro); FiltroResample->SetTransform(transform); >>>> FiltroResample->Update(); >>>> ------------------------------ >>>> View this message in context: Rotating image results in last slices >>>> being half empty >>>> >>>> Sent from the ITK - 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 >>>> >>>> >>> >>> _____________________________________ >>> 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 >>> >>> >>> ------------------------------ >>> If you reply to this email, your message will be added to the discussion >>> below: >>> http://itk-users.7.n7.nabble.com/Rotating-image-results-in-l >>> ast-slices-being-half-empty-tp38081p38116.html >>> To unsubscribe from Rotating image results in last slices being half >>> empty, click here. >>> NAML >>> >>> -- >>> Matias >>> >>> ------------------------------ >>> View this message in context: Re: [ITK-users] Rotating image results in >>> last slices being half empty >>> >>> >>> Sent from the ITK - 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 >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Sat Apr 15 10:33:57 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Sat, 15 Apr 2017 10:33:57 -0400 Subject: [ITK] [ITK-users] Rotating image results in last slices being half empty In-Reply-To: References: <1491689302258-38081.post@n7.nabble.com> Message-ID: Hi Matias, center of rotation should use physical units (millimeters). Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Sat, Apr 15, 2017 at 10:27 AM, Matias Montroull wrote: > Dzenan, > The center of rotation is set to use milimeters or image coordinates? > Thanks > > Matias > > On Apr 14, 2017 2:17 PM, "D?enan Zuki?" wrote: > >> Here is the code I used: >> >> #include >> #include >> #include >> #include >> >> template< typename TImage > >> itk::SmartPointer ReadImage(const char *filename) >> { >> typedef itk::ImageFileReader ReaderType; >> typename ReaderType::Pointer r = ReaderType::New(); >> r->SetFileName(filename); >> r->Update(); >> return r->GetOutput(); >> } >> >> template< typename TImage > >> void WriteImage(itk::SmartPointer out, const char *filename) >> { >> typedef itk::ImageFileWriter WriterType; >> typename WriterType::Pointer w = WriterType::New(); >> w->SetInput(out); >> w->SetFileName(filename); >> //w->SetUseCompression(true); >> w->Update(); >> } >> >> int main(int argc, char *argv[]) >> { >> const unsigned int dimension = 3; >> typedef itk::Image ImageType; >> ImageType::Pointer inputImage = ReadImage("C:/CBCT.nrrd"); >> >> typedef itk::ResampleImageFilter FilterType; >> FilterType::Pointer FiltroResample = FilterType::New(); >> FiltroResample->SetInput(inputImage); >> typedef itk::LinearInterpolateImageFunction >> InterpolatorType; >> InterpolatorType::Pointer interpolator = InterpolatorType::New(); >> FiltroResample->SetInterpolator(interpolator); >> FiltroResample->SetOutputDirection(inputImage->GetDirection()); >> FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); >> ImageType::SizeType inputSize = inputImage->GetLargestPossible >> Region().GetSize(); >> FiltroResample->SetSize(inputSize); >> const ImageType::SpacingType& inputSpacing = inputImage->GetSpacing(); >> FiltroResample->SetOutputSpacing(inputSpacing); >> FiltroResample->SetDefaultPixelValue(-1000); >> typedef itk::Euler3DTransform TransformType; >> TransformType::Pointer transform = TransformType::New(); >> transform->SetRotation(0.2, 0.3, 0.5); >> double centro[3] = { 10,20,30 }; >> transform->SetCenter(centro); >> FiltroResample->SetTransform(transform); >> FiltroResample->Update(); >> WriteImage(FiltroResample->GetOutput(), >> "C:/cbctResampled.nrrd"); >> } >> >> On Fri, Apr 14, 2017 at 1:15 PM, D?enan Zuki? wrote: >> >>> Hi Matias, >>> >>> I didn't compile to use with Slicer. I only open the input and output >>> image in Slicer to visualize them. >>> >>> But making a Slicer CLI module is fairly easy. You can take a look at >>> one >>> >>> of the existing modules, docs >>> including >>> extension wizard >>> >>> . >>> >>> Regards, >>> D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) >>> >>> On Fri, Apr 14, 2017 at 12:26 PM, Matias wrote: >>> >>>> Thanks Dzenan. I actually use OrigenX and OrigenY to assign it to the >>>> DCM tags. Just curious, how did you compile to use with Slicer? >>>> >>>> El jue., 13 de abr. de 2017 a la(s) 12:14, D?enan Zuki? [via ITK - >>>> Users] <[hidden email] >>>> > escribi?: >>>> >>>>> Hi Matias, >>>>> >>>>> you are not using origenX or origenY after they are defined. But your >>>>> program (with modifications to make it compile) works for me: >>>>> [image: Inline image 1] >>>>> >>>>> Regards, >>>>> D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) >>>>> >>>>> On Sat, Apr 8, 2017 at 6:08 PM, Matias <[hidden email] >>>>> > wrote: >>>>> Hi, I'm rotating a volume (Using the Euler3DTransform) and the final >>>>> set of slices are half black or empty. here's an example when rotating a >>>>> volume of 10 slices: Am I missing something such as changing the origin or >>>>> maybe computing the center incorrectly? (The center is passed as parameter >>>>> from another program) And here's the code I'm using: typedef >>>>> itk::ResampleImageFilter FilterType; >>>>> FilterType::Pointer FiltroResample = FilterType::New(); >>>>> FiltroResample->SetInput(reader->GetOutput()); typedef >>>>> itk::LinearInterpolateImageFunction >>>>> InterpolatorType; InterpolatorType::Pointer interpolator = >>>>> InterpolatorType::New(); FiltroResample->SetInterpolator(interpolator); >>>>> FiltroResample->SetOutputDirection(inputImage->GetDirection()); >>>>> FiltroResample->SetOutputOrigin(inputImage->GetOrigin()); >>>>> ImageType::SizeType inputSize = inputImage->GetLargestPossibleRegion().GetSize(); >>>>> FiltroResample->SetSize(inputSize); const ImageType::SpacingType& >>>>> inputSpacing = inputImage->GetSpacing(); FiltroResample->SetOutputSpacing(inputSpacing); >>>>> FiltroResample->SetDefaultPixelValue(-1000); typedef >>>>> itk::Euler3DTransform< double > TransformType; //Transform >>>>> TransformType::Pointer transform = TransformType::New(); double alfa, beta, >>>>> gamma, centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z, >>>>> origenX,origenY; gamma = atof(argv[2]); beta = atof(argv[3]); alfa = >>>>> atof(argv[4]); centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = >>>>> atof(argv[6]); centro_rotacion_Z = atof(argv[7]); origenX = atof(argv[8]); >>>>> origenY = atof(argv[9]); transform->SetRotation(gamma, beta, alfa); double >>>>> centro[3] = { centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z }; >>>>> transform->SetCenter(centro); FiltroResample->SetTransform(transform); >>>>> FiltroResample->Update(); >>>>> ------------------------------ >>>>> View this message in context: Rotating image results in last slices >>>>> being half empty >>>>> >>>>> Sent from the ITK - 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 >>>>> >>>>> >>>> >>>> _____________________________________ >>>> 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 >>>> >>>> >>>> ------------------------------ >>>> If you reply to this email, your message will be added to the >>>> discussion below: >>>> http://itk-users.7.n7.nabble.com/Rotating-image-results-in-l >>>> ast-slices-being-half-empty-tp38081p38116.html >>>> To unsubscribe from Rotating image results in last slices being half >>>> empty, click here. >>>> NAML >>>> >>>> -- >>>> Matias >>>> >>>> ------------------------------ >>>> View this message in context: Re: [ITK-users] Rotating image results >>>> in last slices being half empty >>>> >>>> >>>> Sent from the ITK - 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 >>>> >>>> >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matimontg at gmail.com Mon Apr 17 19:11:54 2017 From: matimontg at gmail.com (Matias) Date: Mon, 17 Apr 2017 16:11:54 -0700 (MST) Subject: [ITK] [ITK-users] Euler3DTransform not taking user defined Center of Rotation? Message-ID: <1492470714966-38126.post@n7.nabble.com> Hi,I'm trying to rotate a volume and use an user defined center but no matter what value I set, it seems the rotation is always performed using the same center (not sure which, maybe a default center)?Here's the code I'm using.. am I missing something? typedef itk::Euler3DTransform< double > TransformType; //Transform TransformType::Pointer transform = TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z, origenX,origenY; gamma = atof(argv[2]); beta = atof(argv[3]); alfa = atof(argv[4]); centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = atof(argv[6]); centro_rotacion_Z = atof(argv[7]); double centro[3] = { centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z }; transform->SetCenter(centro); transform->SetRotation(gamma, beta, alfa); -- View this message in context: http://itk-users.7.n7.nabble.com/Euler3DTransform-not-taking-user-defined-Center-of-Rotation-tp38126.html Sent from the ITK - Users mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From francois.budin at kitware.com Tue Apr 18 13:46:59 2017 From: francois.budin at kitware.com (Francois Budin) Date: Tue, 18 Apr 2017 13:46:59 -0400 Subject: [ITK] [ITK-users] Euler3DTransform not taking user defined Center of Rotation? In-Reply-To: <1492470714966-38126.post@n7.nabble.com> References: <1492470714966-38126.post@n7.nabble.com> Message-ID: Hello Matias, I used the Euler3DTransform in a python terminal to see if I had problems setting the center and the angle, and everything seems to work as expected: trans=itk.Euler3DTransform.D.New() trans.SetCenter([0,0,0]) trans.SetRotation(10,0,0) trans.TransformPoint([0,0,0]) Out[46]: itkPointD3 ([0, 0, 0]) <-expected as the transform center is [0,0,0] trans.SetCenter([10,0,0]) trans.TransformPoint([0,0,0]) Out[48]: itkPointD3 ([5.16482, -7.96596, 3.62828]) <-rotation not around [0,0,0] but around [10,0,0] To try to understand you problem, I would advise you to print the content of your transform to see if it is set as you expect. In my case, I get: Euler3DTransform (0x18da8a0) RTTI typeinfo: itk::Euler3DTransform Reference Count: 1 Modified Time: 377 Debug: Off Object Name: Observers: none Matrix: 0.483518 -0.362828 0.796596 0.796596 0.559609 -0.228631 -0.362828 0.745113 0.559609 Offset: [5.16482, -7.96596, 3.62828] Center: [10, 0, 0] Translation: [0, 0, 0] Inverse: 0.483518 0.796596 -0.362828 -0.362828 0.559609 0.745113 0.796596 -0.228631 0.559609 Singular: 0 Euler's angles: AngleX=40 AngleY=10 AngleZ=10 m_ComputeZYX = 0 Hope this helps, Francois On Mon, Apr 17, 2017 at 7:11 PM, Matias wrote: > Hi, I'm trying to rotate a volume and use an user defined center but no > matter what value I set, it seems the rotation is always performed using > the same center (not sure which, maybe a default center)? Here's the code > I'm using.. am I missing something? typedef itk::Euler3DTransform< double > > TransformType; //Transform TransformType::Pointer transform = > TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, > centro_rotacion_Y, centro_rotacion_Z, origenX,origenY; gamma = > atof(argv[2]); beta = atof(argv[3]); alfa = atof(argv[4]); > centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = atof(argv[6]); > centro_rotacion_Z = atof(argv[7]); double centro[3] = { centro_rotacion_X, > centro_rotacion_Y, centro_rotacion_Z }; transform->SetCenter(centro); > transform->SetRotation(gamma, beta, alfa); > ------------------------------ > View this message in context: Euler3DTransform not taking user defined > Center of Rotation? > > Sent from the ITK - 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From yxp233 at postech.ac.kr Wed Apr 19 07:53:49 2017 From: yxp233 at postech.ac.kr (=?utf-8?B?WGlhb3BlbmcgWWFuZyjsgrDsl4Xqsr3smIHqs7XtlZnqs7wp?=) Date: Wed, 19 Apr 2017 11:53:49 +0000 Subject: [ITK] [ITK-users] Multithreading Message-ID: Dear Users, Have anyone tried to convert ITKFastMarchingImageFilter from single thread to multithread? What is the best way to implement multithreading to that filter? Thank you. Best regards, Xiaopeng _____________________________________ 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 From sidharta.gupta93 at gmail.com Wed Apr 19 09:40:38 2017 From: sidharta.gupta93 at gmail.com (sidharta) Date: Wed, 19 Apr 2017 06:40:38 -0700 (MST) Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: References: <1491926413097-38091.post@n7.nabble.com> <1491997495031-38097.post@n7.nabble.com> <1492088644485-38110.post@n7.nabble.com> <1492095684045-38115.post@n7.nabble.com> <1492097632375-38118.post@n7.nabble.com> Message-ID: <1492609238543-38129.post@n7.nabble.com> Hi D?enan, Thank you for your reply. I implemented this, and learned some cool stuff in 3DSlicer (in order to compare the two images) but as you said, the size is difficult to compute. When I set the origin explicitly, to the start of the trajectory, the resampled image looks good in the direction I want it to be in, however, lot of information is lost. After putting my head into it for the past two weeks, I realized there are other ways to achieve I want this too. Does it make sense to you that I construct another 2D image (or 3D with thickness 1) by essentially copying the voxel values at the trajectory points and around it (probably the size equal to the dimensions of the original image in the x,y direction)? The aim ultimately is in fact to get one slice which best represents the HU values. I apologize for asking such silly questions. Just putting the code of what I did, let me know if it is in fact what you suggested me to do: Vector3d ST, SP, normal_to_plane; ST = traj_end - traj_start; SP = third_point - traj_start; normal_to_plane = ST.cross(SP); std::cout << "Vector ST : " << ST << " Vector SP : " << SP << " Direction of normal : " << normal_to_plane << std::endl; InternalImageType::DirectionType dir; // vector from start to the end of the trajectory Vector3d normalized_ST = ST.normalized(); dir[0][0] = normalized_ST[0]; dir[0][1] = normalized_ST[1]; dir[0][2] = normalized_ST[2]; Vector3d second = normal_to_plane.cross(ST); Vector3d normalized_second = second.normalized(); dir[1][0] = normalized_second[0]; dir[1][1] = normalized_second[1]; dir[1][2] = normalized_second[2]; Vector3d normalized_normal = normal_to_plane.normalized(); dir[2][0] = normalized_normal[0]; dir[2][1] = normalized_normal[1]; dir[2][2] = normalized_normal[2]; // traj_start += normalized_second * 10; double mpr_start[3] = { traj_start[0] , traj_start[1] , traj_start[2]}; std::cout << "Previous image direction " << image->GetDirection() << std::endl; std::cout << "New Image Direction " << dir << std::endl; getSliceMPR(image, mpr_start, dir); void getSliceMPR(InternalImageType::Pointer &image, double output_origin[Dimension], InternalImageType::DirectionType dir) { // Instantiate Resample Filter here ResampleFilterType::Pointer filter = ResampleFilterType::New(); // Instantiate Transform for resampling // Changing the Output direction instead of setting the transform // filter->SetTransform(transform); typedef itk::NearestNeighborInterpolateImageFunction< InternalImageType, double> InterpolatorType; // Instantiate the interpolator InterpolatorType::Pointer interpolator = InterpolatorType::New(); filter->SetInterpolator(interpolator); // Set pixels of the output image that end up being mapped outside the extent of the input image to -1500 filter->SetDefaultPixelValue(-1500); // Sampling grid of the output space - pixel spacing in mm // Hard coded here filter->SetOutputSpacing(image->GetSpacing()); // filter->SetOutputOrigin(image->GetOrigin()); filter->SetOutputOrigin(output_origin); filter->SetOutputDirection(dir); InternalImageType::SizeType size; filter->SetSize(image->GetLargestPossibleRegion().GetSize()); filter->SetInput(image); typedef itk::ImageFileWriter WriterType; WriterType::Pointer writer = WriterType::New(); writer->SetFileName("C:/Users/api/Desktop/Resampled/resampled_2.mhd"); writer->SetUseCompression(true); writer->SetInput(filter->GetOutput()); try{ writer->Update(); } catch (itk::ExceptionObject & excep){ std::cerr << "Exception catched!.." << std::endl; std::cerr << excep << std::endl; } } -- View this message in context: http://itk-users.7.n7.nabble.com/Extract-slice-from-ResampleFilter-tp38074p38129.html Sent from the ITK - 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 From tenyssonwill at gmail.com Wed Apr 19 09:55:55 2017 From: tenyssonwill at gmail.com (Tenysson) Date: Wed, 19 Apr 2017 10:55:55 -0300 Subject: [ITK] Python Wrapping with no Image Module Message-ID: I built the ITK with Python Wrapper in 64 bits in Release mode, using the python 2.7 and Visual Studio Community 2015, with no errors. I copy the files and folders generate in Install/lib/site-packages to C:\Python27\Lib\site-packages. I use in python import itk and seems to be ok. But I'm not finding the module Image, like itk.Image I don't know if it was not generate or where is it. In python just show the module below. Someone could help me? >>> itk. itk.B itk.ITKIOSiemens itk.ITKRegistrationCommon itk.__new__( itk.ios_base_xalloc( itk.D itk.ITKIOSpatialObjects itk.ITKRegistrationMethodsv4 itk.__path__ itk.iostream( itk.F itk.ITKIOStimulate itk.ITKSmoothing itk.__reduce__( itk.ipython_kw_matches( itk.ITKAnisotropicSmoothing itk.ITKIOTIFF itk.ITKSpatialObjects itk.__reduce_ex__( itk.istream( itk.ITKAntiAlias itk.ITKIOTransformBase itk.ITKStatistics itk.__repr__( itk.itkConfig itk.ITKBinaryMathematicalMorphology itk.ITKIOVTK itk.ITKTestKernel itk.__setattr__( itk.list itk.ITKClassifiers itk.ITKImageCompare itk.ITKThresholding itk.__sizeof__( itk.map itk.ITKColormap itk.ITKImageCompose itk.ITKTransform itk.__str__( itk.number_of_objects( itk.ITKCommon itk.ITKImageFeature itk.ITKVTK itk.__subclasshook__( itk.origin( itk.ITKConnectedComponents itk.ITKImageFilterBase itk.ITKVoronoi itk.__weakref__ itk.ostream( itk.ITKConvolution itk.ITKImageFunction itk.ITKVtkGlue itk.attribute_dict( itk.output( itk.ITKCurvatureFlow itk.ITKImageFusion itk.ITKWatersheds itk.attribute_list( itk.physical_size( itk.ITKDeconvolution itk.ITKImageGradient itk.LD itk.attributes_list( itk.pipeline( itk.ITKDisplacementField itk.ITKImageGrid itk.SC itk.auto_not_in_place( itk.print_function itk.ITKDistanceMap itk.ITKImageIntensity itk.SI itk.auto_pipeline( itk.range( itk.ITKEigen itk.ITKImageLabel itk.SL itk.auto_progress( itk.region( itk.ITKFFT itk.ITKImageNoise itk.SLL itk.cerr itk.search( itk.ITKFastMarching itk.ITKImageSources itk.SS itk.cin itk.set itk.ITKFiniteDifference itk.ITKImageStatistics itk.UC itk.class_( itk.set_inputs( itk.ITKIOBMP itk.ITKLabelMap itk.UI itk.clog itk.show( itk.ITKIOBioRad itk.ITKLabelVoting itk.UL itk.clrLine itk.show2D itk.ITKIOGDCM itk.ITKLevelSets itk.ULL itk.cout itk.simple_import_callback( itk.ITKIOGE itk.ITKMathematicalMorphology itk.US itk.ctype( itk.simple_progress_callback( itk.ITKIOGIPL itk.ITKMesh itk.WrapITKBuildOptions itk.cvar itk.size( itk.ITKIOHDF5 itk.ITKMetricsv4 itk._LazyITKModule__belong_lazy_attributes itk.down_cast( itk.spacing( itk.ITKIOIPL itk.ITKNarrowBand itk.__class__( itk.echo( itk.string( itk.ITKIOImageBase itk.ITKOptimizers itk.__delattr__( itk.endl( itk.swig itk.ITKIOJPEG itk.ITKOptimizersv4 itk.__dict__ itk.ends( itk.template( itk.ITKIOLSM itk.ITKPDEDeformableRegistration itk.__doc__ itk.flush( itk.templated_class itk.ITKIOMRC itk.ITKPath itk.__format__( itk.force_load( itk.terminal_import_callback( itk.ITKIOMeta itk.ITKPyBase itk.__getattribute__( itk.image( itk.terminal_progress_callback( itk.ITKIONIFTI itk.ITKPyUtils itk.__hash__( itk.index( itk.vector itk.ITKIONRRD itk.ITKQuadEdgeMesh itk.__init__( itk.ios( itk.write( itk.ITKIOPNG itk.ITKQuadEdgeMeshFiltering itk.__module__ itk.ios_base( itk.ITKIORAW itk.ITKRegionGrowing itk.__name__ itk.ios_base_sync_with_stdio( Build Settings ITK 4.10.1 Platform: Windows 10 compiler : Visual C++ 14.0 in x64 Python 2.7 in x64 CMake 3.6.1 CMake Settings: ITK_WRAP_PYTHON Error message: None Best Regards -- Tenysson Will de Lemos -------------- next part -------------- An HTML attachment was scrubbed... URL: From dzenanz at gmail.com Wed Apr 19 11:29:53 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Wed, 19 Apr 2017 11:29:53 -0400 Subject: [ITK] [ITK-users] Extract slice from ResampleFilter In-Reply-To: <1492609238543-38129.post@n7.nabble.com> References: <1491926413097-38091.post@n7.nabble.com> <1491997495031-38097.post@n7.nabble.com> <1492088644485-38110.post@n7.nabble.com> <1492095684045-38115.post@n7.nabble.com> <1492097632375-38118.post@n7.nabble.com> <1492609238543-38129.post@n7.nabble.com> Message-ID: Hi Sidharta, you seem to have implemented what I suggested. "essentially copying the voxel values at the trajectory points and around it" can be achieved by using nearest neighbor interpolator instead of linear interpolator. But it looks like you are already using nearest neighbor, so you should try using linear interpolator, or even windowed sinc interpolator to get higher quality. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Wed, Apr 19, 2017 at 9:40 AM, sidharta wrote: > Hi D?enan, > > Thank you for your reply. I implemented this, and learned some cool stuff > in > 3DSlicer (in order to compare the two images) but as you said, the size is > difficult to compute. When I set the origin explicitly, to the start of the > trajectory, the resampled image looks good in the direction I want it to be > in, however, lot of information is lost. After putting my head into it for > the past two weeks, I realized there are other ways to achieve I want this > too. Does it make sense to you that I construct another 2D image (or 3D > with > thickness 1) by essentially copying the voxel values at the trajectory > points and around it (probably the size equal to the dimensions of the > original image in the x,y direction)? The aim ultimately is in fact to get > one slice which best represents the HU values. I apologize for asking such > silly questions. > > Just putting the code of what I did, let me know if it is in fact what you > suggested me to do: > > Vector3d ST, SP, normal_to_plane; > ST = traj_end - traj_start; > SP = third_point - traj_start; > normal_to_plane = ST.cross(SP); > std::cout << "Vector ST : " << ST << " Vector SP : " << SP << " > Direction > of normal : " << normal_to_plane << std::endl; > > InternalImageType::DirectionType dir; > // vector from start to the end of the trajectory > Vector3d normalized_ST = ST.normalized(); > dir[0][0] = normalized_ST[0]; > dir[0][1] = normalized_ST[1]; > dir[0][2] = normalized_ST[2]; > > Vector3d second = normal_to_plane.cross(ST); > Vector3d normalized_second = second.normalized(); > dir[1][0] = normalized_second[0]; > dir[1][1] = normalized_second[1]; > dir[1][2] = normalized_second[2]; > > Vector3d normalized_normal = normal_to_plane.normalized(); > dir[2][0] = normalized_normal[0]; > dir[2][1] = normalized_normal[1]; > dir[2][2] = normalized_normal[2]; > > // traj_start += normalized_second * 10; > double mpr_start[3] = { traj_start[0] , traj_start[1] , > traj_start[2]}; > > std::cout << "Previous image direction " << image->GetDirection() > << > std::endl; > std::cout << "New Image Direction " << dir << std::endl; > > getSliceMPR(image, mpr_start, dir); > > void getSliceMPR(InternalImageType::Pointer &image, double > output_origin[Dimension], InternalImageType::DirectionType dir) > { > > // Instantiate Resample Filter here > ResampleFilterType::Pointer filter = ResampleFilterType::New(); > // Instantiate Transform for resampling > // Changing the Output direction instead of setting the transform > // filter->SetTransform(transform); > > typedef itk::NearestNeighborInterpolateImageFunction< > InternalImageType, double> InterpolatorType; > > // Instantiate the interpolator > InterpolatorType::Pointer interpolator = InterpolatorType::New(); > filter->SetInterpolator(interpolator); > > // Set pixels of the output image that end up being mapped outside > the > extent of the input image to -1500 > filter->SetDefaultPixelValue(-1500); > > // Sampling grid of the output space - pixel spacing in mm > // Hard coded here > filter->SetOutputSpacing(image->GetSpacing()); > > > // filter->SetOutputOrigin(image->GetOrigin()); > > filter->SetOutputOrigin(output_origin); > filter->SetOutputDirection(dir); > InternalImageType::SizeType size; > filter->SetSize(image->GetLargestPossibleRegion().GetSize()); > > filter->SetInput(image); > > typedef itk::ImageFileWriter WriterType; > > WriterType::Pointer writer = WriterType::New(); > writer->SetFileName("C:/Users/api/Desktop/Resampled/ > resampled_2.mhd"); > writer->SetUseCompression(true); > writer->SetInput(filter->GetOutput()); > try{ > writer->Update(); > > } > catch (itk::ExceptionObject & excep){ > > std::cerr << "Exception catched!.." << std::endl; > std::cerr << excep << std::endl; > } > > } > > > > -- > View this message in context: http://itk-users.7.n7.nabble. > com/Extract-slice-from-ResampleFilter-tp38074p38129.html > Sent from the ITK - 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matimontg at gmail.com Wed Apr 19 11:56:09 2017 From: matimontg at gmail.com (Matias) Date: Wed, 19 Apr 2017 08:56:09 -0700 (MST) Subject: [ITK] [ITK-users] Euler3DTransform not taking user defined Center of Rotation? In-Reply-To: References: <1492470714966-38126.post@n7.nabble.com> Message-ID: Thanks Francois, There's something strange in the matrix and Offset, this is what I get: Center: [-246.422, -149.871, 20] Matrix: 1 0 0 0 1 0 0 0 1 Offset: [0, 0, 0] El mar., 18 de abr. de 2017 a la(s) 14:47, Francois Budin-3 [via ITK - Users] escribi?: > Hello Matias, > > I used the Euler3DTransform in a python terminal to see if I had problems > setting the center and the angle, and everything seems to work as expected: > > trans=itk.Euler3DTransform.D.New() > trans.SetCenter([0,0,0]) > trans.SetRotation(10,0,0) > trans.TransformPoint([0,0,0]) > Out[46]: itkPointD3 ([0, 0, 0]) <-expected as the transform center is > [0,0,0] > > trans.SetCenter([10,0,0]) > trans.TransformPoint([0,0,0]) > Out[48]: itkPointD3 ([5.16482, -7.96596, 3.62828]) <-rotation not around > [0,0,0] but around [10,0,0] > > To try to understand you problem, I would advise you to print the content > of your transform to see if it is set as you expect. In my case, I get: > > Euler3DTransform (0x18da8a0) > RTTI typeinfo: itk::Euler3DTransform > Reference Count: 1 > Modified Time: 377 > Debug: Off > Object Name: > Observers: > none > Matrix: > 0.483518 -0.362828 0.796596 > 0.796596 0.559609 -0.228631 > -0.362828 0.745113 0.559609 > Offset: [5.16482, -7.96596, 3.62828] > Center: [10, 0, 0] > Translation: [0, 0, 0] > Inverse: > 0.483518 0.796596 -0.362828 > -0.362828 0.559609 0.745113 > 0.796596 -0.228631 0.559609 > Singular: 0 > Euler's angles: AngleX=40 AngleY=10 AngleZ=10 > m_ComputeZYX = 0 > > Hope this helps, > Francois > > > > On Mon, Apr 17, 2017 at 7:11 PM, Matias <[hidden email] > > wrote: > >> Hi, I'm trying to rotate a volume and use an user defined center but no >> matter what value I set, it seems the rotation is always performed using >> the same center (not sure which, maybe a default center)? Here's the code >> I'm using.. am I missing something? typedef itk::Euler3DTransform< double > >> TransformType; //Transform TransformType::Pointer transform = >> TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, >> centro_rotacion_Y, centro_rotacion_Z, origenX,origenY; gamma = >> atof(argv[2]); beta = atof(argv[3]); alfa = atof(argv[4]); >> centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = atof(argv[6]); >> centro_rotacion_Z = atof(argv[7]); double centro[3] = { centro_rotacion_X, >> centro_rotacion_Y, centro_rotacion_Z }; transform->SetCenter(centro); >> transform->SetRotation(gamma, beta, alfa); >> ------------------------------ >> View this message in context: Euler3DTransform not taking user defined >> Center of Rotation? >> >> Sent from the ITK - 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 >> >> > > _____________________________________ > 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 > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://itk-users.7.n7.nabble.com/Euler3DTransform-not-taking-user-defined-Center-of-Rotation-tp38126p38127.html > To unsubscribe from Euler3DTransform not taking user defined Center of > Rotation?, click here > > . > NAML > > -- Matias -- View this message in context: http://itk-users.7.n7.nabble.com/Euler3DTransform-not-taking-user-defined-Center-of-Rotation-tp38126p38131.html Sent from the ITK - Users mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From francois.budin at kitware.com Wed Apr 19 13:30:14 2017 From: francois.budin at kitware.com (Francois Budin) Date: Wed, 19 Apr 2017 13:30:14 -0400 Subject: [ITK] [ITK-users] Euler3DTransform not taking user defined Center of Rotation? In-Reply-To: References: <1492470714966-38126.post@n7.nabble.com> Message-ID: Hello Matias, I created a small executable based on the code you sent me: #include int main(int argc, char* argv[]) { typedef itk::Euler3DTransform< double > TransformType; //Transform TransformType::Pointer transform = TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z, origenX,origenY; gamma = atof(argv[2]); beta = atof(argv[3]); alfa = atof(argv[4]); centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = atof(argv[6]); centro_rotacion_Z = atof(argv[7]); double centro[3] = { centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z }; transform->SetCenter(centro); transform->SetRotation(gamma, beta, alfa); std::cout<GetCenter()<GetMatrix()< Reference Count: 2 Modified Time: 3 Debug: Off Object Name: Observers: none Matrix: 0.56923 -0.304067 0.763885 0.716525 -0.272165 -0.642275 0.403198 0.912945 0.0629472 Offset: [-13.6894, 85.4629, -9.34292] Center: [50, 60, 70] Translation: [0, 0, 0] Inverse: 0.56923 0.716525 0.403198 -0.304067 -0.272165 0.912945 0.763885 -0.642275 0.0629472 Singular: 0 Euler's angles: AngleX=20 AngleY=30 AngleZ=40 m_ComputeZYX = 0 On Wed, Apr 19, 2017 at 11:56 AM, Matias wrote: > Thanks Francois, > > There's something strange in the matrix and Offset, this is what I get: > > Center: > > [-246.422, -149.871, 20] > > Matrix: > 1 0 0 > 0 1 0 > 0 0 1 > > Offset: > [0, 0, 0] > > El mar., 18 de abr. de 2017 a la(s) 14:47, Francois Budin-3 [via ITK - > Users] <[hidden email] > > escribi?: > >> Hello Matias, >> >> I used the Euler3DTransform in a python terminal to see if I had problems >> setting the center and the angle, and everything seems to work as expected: >> >> trans=itk.Euler3DTransform.D.New() >> trans.SetCenter([0,0,0]) >> trans.SetRotation(10,0,0) >> trans.TransformPoint([0,0,0]) >> Out[46]: itkPointD3 ([0, 0, 0]) <-expected as the transform center is >> [0,0,0] >> >> trans.SetCenter([10,0,0]) >> trans.TransformPoint([0,0,0]) >> Out[48]: itkPointD3 ([5.16482, -7.96596, 3.62828]) <-rotation not around >> [0,0,0] but around [10,0,0] >> >> To try to understand you problem, I would advise you to print the content >> of your transform to see if it is set as you expect. In my case, I get: >> >> Euler3DTransform (0x18da8a0) >> RTTI typeinfo: itk::Euler3DTransform >> Reference Count: 1 >> Modified Time: 377 >> Debug: Off >> Object Name: >> Observers: >> none >> Matrix: >> 0.483518 -0.362828 0.796596 >> 0.796596 0.559609 -0.228631 >> -0.362828 0.745113 0.559609 >> Offset: [5.16482, -7.96596, 3.62828] >> Center: [10, 0, 0] >> Translation: [0, 0, 0] >> Inverse: >> 0.483518 0.796596 -0.362828 >> -0.362828 0.559609 0.745113 >> 0.796596 -0.228631 0.559609 >> Singular: 0 >> Euler's angles: AngleX=40 AngleY=10 AngleZ=10 >> m_ComputeZYX = 0 >> >> Hope this helps, >> Francois >> >> >> >> On Mon, Apr 17, 2017 at 7:11 PM, Matias <[hidden email] >> > wrote: >> Hi, I'm trying to rotate a volume and use an user defined center but no >> matter what value I set, it seems the rotation is always performed using >> the same center (not sure which, maybe a default center)? Here's the code >> I'm using.. am I missing something? typedef itk::Euler3DTransform< double > >> TransformType; //Transform TransformType::Pointer transform = >> TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, >> centro_rotacion_Y, centro_rotacion_Z, origenX,origenY; gamma = >> atof(argv[2]); beta = atof(argv[3]); alfa = atof(argv[4]); >> centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = atof(argv[6]); >> centro_rotacion_Z = atof(argv[7]); double centro[3] = { centro_rotacion_X, >> centro_rotacion_Y, centro_rotacion_Z }; transform->SetCenter(centro); >> transform->SetRotation(gamma, beta, alfa); >> ------------------------------ >> View this message in context: Euler3DTransform not taking user defined >> Center of Rotation? >> >> Sent from the ITK - 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 >> >> > > _____________________________________ > 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 > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > http://itk-users.7.n7.nabble.com/Euler3DTransform-not- > taking-user-defined-Center-of-Rotation-tp38126p38127.html > To unsubscribe from Euler3DTransform not taking user defined Center of > Rotation?, click here. > NAML > > -- > Matias > > ------------------------------ > View this message in context: Re: [ITK-users] Euler3DTransform not taking > user defined Center of Rotation? > > > Sent from the ITK - 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matt.mccormick at kitware.com Wed Apr 19 14:28:01 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Wed, 19 Apr 2017 14:28:01 -0400 Subject: [ITK] Python Wrapping with no Image Module In-Reply-To: References: Message-ID: Hi Tenysson, Welcome to ITK! The ITK Python wrapping uses lazy loading by default (this increases interactive loading speed). What we see there is only the ITK modules and a few special functions. If you are using the IPython terminal [1], once the tab is pressed for completion, it will load all the modules. When used in a script, only the modules that are required are loaded as needed. To force load all the modules and see all the classes available, call itk.force_load() We have beta Python packages, including binary packages for Python 2.7 on Windows. These may be worth a try because they are built with the same Visual Studio compiler as the compiler used to build the python.org distributions, which ensures C runtime compatibility. They can be installed with: python -m pip install --upgrade pip python -m pip install itk -f https://github.com/InsightSoftwareConsortium/ITKPythonPackage/releases/tag/latest Thanks, Matt [1] https://ipython.org/ On Wed, Apr 19, 2017 at 9:55 AM, Tenysson wrote: > I built the ITK with Python Wrapper in 64 bits in Release mode, using the > python 2.7 and Visual Studio Community 2015, with no errors. > I copy the files and folders generate in Install/lib/site-packages to > C:\Python27\Lib\site-packages. > I use in python import itk and seems to be ok. But I'm not finding the > module Image, like itk.Image > I don't know if it was not generate or where is it. In python just show the > module below. > Someone could help me? > >>>> itk. > itk.B itk.ITKIOSiemens > itk.ITKRegistrationCommon itk.__new__( > itk.ios_base_xalloc( > itk.D itk.ITKIOSpatialObjects > itk.ITKRegistrationMethodsv4 itk.__path__ > itk.iostream( > itk.F itk.ITKIOStimulate > itk.ITKSmoothing itk.__reduce__( > itk.ipython_kw_matches( > itk.ITKAnisotropicSmoothing itk.ITKIOTIFF > itk.ITKSpatialObjects itk.__reduce_ex__( > itk.istream( > itk.ITKAntiAlias itk.ITKIOTransformBase > itk.ITKStatistics itk.__repr__( > itk.itkConfig > itk.ITKBinaryMathematicalMorphology itk.ITKIOVTK > itk.ITKTestKernel itk.__setattr__( > itk.list > itk.ITKClassifiers itk.ITKImageCompare > itk.ITKThresholding itk.__sizeof__( > itk.map > itk.ITKColormap itk.ITKImageCompose > itk.ITKTransform itk.__str__( > itk.number_of_objects( > itk.ITKCommon itk.ITKImageFeature > itk.ITKVTK itk.__subclasshook__( > itk.origin( > itk.ITKConnectedComponents itk.ITKImageFilterBase > itk.ITKVoronoi itk.__weakref__ > itk.ostream( > itk.ITKConvolution itk.ITKImageFunction > itk.ITKVtkGlue itk.attribute_dict( > itk.output( > itk.ITKCurvatureFlow itk.ITKImageFusion > itk.ITKWatersheds itk.attribute_list( > itk.physical_size( > itk.ITKDeconvolution itk.ITKImageGradient > itk.LD itk.attributes_list( > itk.pipeline( > itk.ITKDisplacementField itk.ITKImageGrid > itk.SC itk.auto_not_in_place( > itk.print_function > itk.ITKDistanceMap itk.ITKImageIntensity > itk.SI itk.auto_pipeline( > itk.range( > itk.ITKEigen itk.ITKImageLabel > itk.SL itk.auto_progress( > itk.region( > itk.ITKFFT itk.ITKImageNoise > itk.SLL itk.cerr > itk.search( > itk.ITKFastMarching itk.ITKImageSources > itk.SS itk.cin > itk.set > itk.ITKFiniteDifference itk.ITKImageStatistics > itk.UC itk.class_( > itk.set_inputs( > itk.ITKIOBMP itk.ITKLabelMap > itk.UI itk.clog > itk.show( > itk.ITKIOBioRad itk.ITKLabelVoting > itk.UL itk.clrLine > itk.show2D > itk.ITKIOGDCM itk.ITKLevelSets > itk.ULL itk.cout > itk.simple_import_callback( > itk.ITKIOGE itk.ITKMathematicalMorphology > itk.US itk.ctype( > itk.simple_progress_callback( > itk.ITKIOGIPL itk.ITKMesh > itk.WrapITKBuildOptions itk.cvar > itk.size( > itk.ITKIOHDF5 itk.ITKMetricsv4 > itk._LazyITKModule__belong_lazy_attributes itk.down_cast( > itk.spacing( > itk.ITKIOIPL itk.ITKNarrowBand > itk.__class__( itk.echo( > itk.string( > itk.ITKIOImageBase itk.ITKOptimizers > itk.__delattr__( itk.endl( > itk.swig > itk.ITKIOJPEG itk.ITKOptimizersv4 > itk.__dict__ itk.ends( > itk.template( > itk.ITKIOLSM itk.ITKPDEDeformableRegistration > itk.__doc__ itk.flush( > itk.templated_class > itk.ITKIOMRC itk.ITKPath > itk.__format__( itk.force_load( > itk.terminal_import_callback( > itk.ITKIOMeta itk.ITKPyBase > itk.__getattribute__( itk.image( > itk.terminal_progress_callback( > itk.ITKIONIFTI itk.ITKPyUtils > itk.__hash__( itk.index( > itk.vector > itk.ITKIONRRD itk.ITKQuadEdgeMesh > itk.__init__( itk.ios( > itk.write( > itk.ITKIOPNG itk.ITKQuadEdgeMeshFiltering > itk.__module__ itk.ios_base( > itk.ITKIORAW itk.ITKRegionGrowing > itk.__name__ itk.ios_base_sync_with_stdio( > > > Build Settings > ITK 4.10.1 > Platform: Windows 10 > compiler : Visual C++ 14.0 in x64 > Python 2.7 in x64 > CMake 3.6.1 > CMake Settings: ITK_WRAP_PYTHON > Error message: None > > Best Regards > -- > Tenysson Will de Lemos > > > _______________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community > From dzenanz at gmail.com Wed Apr 19 14:36:50 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Wed, 19 Apr 2017 14:36:50 -0400 Subject: [ITK] [ITK-users] Euler3DTransform not taking user defined Center of Rotation? In-Reply-To: References: <1492470714966-38126.post@n7.nabble.com> Message-ID: Hi Matias, translation (called offset in some of the classes) and center of rotation are different things, and taken care of differently. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Wed, Apr 19, 2017 at 1:30 PM, Francois Budin wrote: > Hello Matias, > > I created a small executable based on the code you sent me: > > #include > > int main(int argc, char* argv[]) > { > typedef itk::Euler3DTransform< double > TransformType; > //Transform > TransformType::Pointer transform = TransformType::New(); > double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, > centro_rotacion_Z, origenX,origenY; > gamma = atof(argv[2]); > beta = atof(argv[3]); > alfa = atof(argv[4]); > centro_rotacion_X = atof(argv[5]); > centro_rotacion_Y = atof(argv[6]); > centro_rotacion_Z = atof(argv[7]); > double centro[3] = { centro_rotacion_X, centro_rotacion_Y, > centro_rotacion_Z }; > transform->SetCenter(centro); > transform->SetRotation(gamma, beta, alfa); > std::cout<GetCenter()< std::cout<GetMatrix()< std::cout< return 0; > } > > And the results are correct: > ./Euler 10 20 30 40 50 60 70 > [50, 60, 70] > 0.56923 -0.304067 0.763885 > 0.716525 -0.272165 -0.642275 > 0.403198 0.912945 0.0629472 > > Euler3DTransform (0x1126e80) > RTTI typeinfo: itk::Euler3DTransform > Reference Count: 2 > Modified Time: 3 > Debug: Off > Object Name: > Observers: > none > Matrix: > 0.56923 -0.304067 0.763885 > 0.716525 -0.272165 -0.642275 > 0.403198 0.912945 0.0629472 > Offset: [-13.6894, 85.4629, -9.34292] > Center: [50, 60, 70] > Translation: [0, 0, 0] > Inverse: > 0.56923 0.716525 0.403198 > -0.304067 -0.272165 0.912945 > 0.763885 -0.642275 0.0629472 > Singular: 0 > Euler's angles: AngleX=20 AngleY=30 AngleZ=40 > m_ComputeZYX = 0 > > > On Wed, Apr 19, 2017 at 11:56 AM, Matias wrote: > >> Thanks Francois, >> >> There's something strange in the matrix and Offset, this is what I get: >> >> Center: >> >> [-246.422, -149.871, 20] >> >> Matrix: >> 1 0 0 >> 0 1 0 >> 0 0 1 >> >> Offset: >> [0, 0, 0] >> >> El mar., 18 de abr. de 2017 a la(s) 14:47, Francois Budin-3 [via ITK - >> Users] <[hidden email] >> > escribi?: >> >>> Hello Matias, >>> >>> I used the Euler3DTransform in a python terminal to see if I had >>> problems setting the center and the angle, and everything seems to work as >>> expected: >>> >>> trans=itk.Euler3DTransform.D.New() >>> trans.SetCenter([0,0,0]) >>> trans.SetRotation(10,0,0) >>> trans.TransformPoint([0,0,0]) >>> Out[46]: itkPointD3 ([0, 0, 0]) <-expected as the transform center is >>> [0,0,0] >>> >>> trans.SetCenter([10,0,0]) >>> trans.TransformPoint([0,0,0]) >>> Out[48]: itkPointD3 ([5.16482, -7.96596, 3.62828]) <-rotation not around >>> [0,0,0] but around [10,0,0] >>> >>> To try to understand you problem, I would advise you to print the >>> content of your transform to see if it is set as you expect. In my case, I >>> get: >>> >>> Euler3DTransform (0x18da8a0) >>> RTTI typeinfo: itk::Euler3DTransform >>> Reference Count: 1 >>> Modified Time: 377 >>> Debug: Off >>> Object Name: >>> Observers: >>> none >>> Matrix: >>> 0.483518 -0.362828 0.796596 >>> 0.796596 0.559609 -0.228631 >>> -0.362828 0.745113 0.559609 >>> Offset: [5.16482, -7.96596, 3.62828] >>> Center: [10, 0, 0] >>> Translation: [0, 0, 0] >>> Inverse: >>> 0.483518 0.796596 -0.362828 >>> -0.362828 0.559609 0.745113 >>> 0.796596 -0.228631 0.559609 >>> Singular: 0 >>> Euler's angles: AngleX=40 AngleY=10 AngleZ=10 >>> m_ComputeZYX = 0 >>> >>> Hope this helps, >>> Francois >>> >>> >>> >>> On Mon, Apr 17, 2017 at 7:11 PM, Matias <[hidden email] >>> > wrote: >>> Hi, I'm trying to rotate a volume and use an user defined center but no >>> matter what value I set, it seems the rotation is always performed using >>> the same center (not sure which, maybe a default center)? Here's the code >>> I'm using.. am I missing something? typedef itk::Euler3DTransform< double > >>> TransformType; //Transform TransformType::Pointer transform = >>> TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, >>> centro_rotacion_Y, centro_rotacion_Z, origenX,origenY; gamma = >>> atof(argv[2]); beta = atof(argv[3]); alfa = atof(argv[4]); >>> centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = atof(argv[6]); >>> centro_rotacion_Z = atof(argv[7]); double centro[3] = { centro_rotacion_X, >>> centro_rotacion_Y, centro_rotacion_Z }; transform->SetCenter(centro); >>> transform->SetRotation(gamma, beta, alfa); >>> ------------------------------ >>> View this message in context: Euler3DTransform not taking user defined >>> Center of Rotation? >>> >>> Sent from the ITK - 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 >>> >>> >> >> _____________________________________ >> 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 >> >> >> ------------------------------ >> If you reply to this email, your message will be added to the discussion >> below: >> http://itk-users.7.n7.nabble.com/Euler3DTransform-not-taking >> -user-defined-Center-of-Rotation-tp38126p38127.html >> To unsubscribe from Euler3DTransform not taking user defined Center of >> Rotation?, click here. >> NAML >> >> -- >> Matias >> >> ------------------------------ >> View this message in context: Re: [ITK-users] Euler3DTransform not >> taking user defined Center of Rotation? >> >> >> Sent from the ITK - 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 >> >> > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Wed Apr 19 15:57:09 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Wed, 19 Apr 2017 15:57:09 -0400 Subject: [ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa) In-Reply-To: References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445968817@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445968862@MBX212.d.ethz.ch> Message-ID: Hi Fabio, I just tested the master branch after CastXML was updated. Unfortunately, it didn't help. The compile errors are still present in VS2017 with wrapping. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Thu, Apr 13, 2017 at 10:48 AM, D?enan Zuki? wrote: > Hi Fabio, > > the first error is coming from ITKCommonCastXML project, and the other > first 1000 errors are also coming from*CastXML and *Swig projects. This > means that the wrapping infrastructure is somehow triggering that bug in > VS2017. > > The easiest thing to try is update CastXML, which Matt said would take > care of. Let's see if that helps. > > Regards, > D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) > > On Wed, Apr 12, 2017 at 4:50 PM, D?enan Zuki? wrote: > >> Hi Fabio, >> >> it looks like we will have to wait somewhat until VS writers get around >> to implement __builtin_offsetof >> >> >> I don't know why it doesn't trigger when Python wrapping is OFF. I will >> look into it more. >> >> Regards, >> D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) >> >> On Wed, Apr 12, 2017 at 4:26 PM, Francois Budin < >> francois.budin at kitware.com> wrote: >> >>> Fabio, >>> >>> To add a little bit of extra information about using BridgeNumpy: >>> >>> From NumPy to ITK, the memory is never copied, and always shared between >>> the NumPy array and the ITK image. >>> From ITK to NumPy, the memory is not copied at first, if the data is not >>> changed from the NumPy side (e.g. if the ITK image is changed, the NumPy >>> array will be modified too), but if you modify the NumPy array directly, >>> NumPy will create a copy of the data. This also means that if you were to >>> modify the NumPy array, the modifications would not be visible in the ITK >>> image. >>> >>> A limited workaround to this is: >>> >>> # Get NumPy array from image >>> arr_image = itk.GetArrayFromImage(image) >>> # Create copy of array that can be modified in-place >>> arr = arr_image.copy() >>> # Modify array >>> ? >>> # Update image in-place with new array >>> arr_image.setfield(arr,arr_image.dtype) >>> >>> The advantage of this method is that the image will be updated. However, >>> there is an explicit copy of your data. >>> If the copy step is skipped and the original NumPy array is modified, a >>> copy of the data will be performed by NumPy and you may not be aware of it >>> until you see that the data in the NumPy array and the image do not match >>> anymore. >>> >>> Hope this helps, >>> Francois >>> >>> On Wed, Apr 12, 2017 at 4:02 PM, D'Isidoro Fabio >>> wrote: >>> >>>> Ok, thanks. Moe specifically I am using now *Visual Studio 2017 >>>> Preview*. >>>> >>>> >>>> >>>> Fabio. >>>> >>>> *From:* D?enan Zuki? [mailto:dzenanz at gmail.com] >>>> *Sent:* Mittwoch, 12. April 2017 21:54 >>>> *To:* D'Isidoro Fabio >>>> *Cc:* Matt McCormick ; >>>> insight-users at itk.org >>>> >>>> *Subject:* Re: [ITK-users] ITK Python: numpy to itk image (and >>>> viceversa) >>>> >>>> >>>> >>>> Hi Fabio, >>>> >>>> >>>> >>>> let me give it a try with VS2017 and Wrapping+NumPy. I will report back >>>> when I have an update. >>>> >>>> >>>> >>>> Regards, >>>> >>>> D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) >>>> >>>> >>>> >>>> On Wed, Apr 12, 2017 at 2:16 PM, D'Isidoro Fabio >>>> wrote: >>>> >>>> Thank you. I am trying to build ITK Wrap Python with >>>> Module_BridgeNumPy=ON with Visual Studio 2017. >>>> >>>> I get the following type of errors: >>>> >>>> 12>C:/Program Files (x86)/Microsoft Visual >>>> Studio/Preview/Community/VC/Tools/MSVC/14.10.25017/include\xstring(1905,26): >>>> error G3F63BFAE: constexpr variable '_Memcpy_move_offset' must be >>>> initialized by a constant expression >>>> 12> static constexpr size_t _Memcpy_move_offset = >>>> offsetof(_Mydata_t, _Bx); >>>> 12> ^ >>>> ~~~~~~~~~~~~~~~~~~~~~~~~ >>>> 12>C:/Program Files (x86)/Microsoft Visual >>>> Studio/Preview/Community/VC/Tools/MSVC/14.10.25017/include\stdexcept:23:21: >>>> note: in instantiation of template class 'std::basic_string>>> std::char_traits, std::allocator >' requested here >>>> 12> : _Mybase(_Message.c_str()) >>>> 12> ^ >>>> 12>C:/Program Files (x86)/Microsoft Visual >>>> Studio/Preview/Community/VC/Tools/MSVC/14.10.25017/include\xstring:1905:48: >>>> note: cast that performs the conversions of a reinterpret_cast is not >>>> allowed in a constant expression >>>> 12> static constexpr size_t _Memcpy_move_offset = >>>> offsetof(_Mydata_t, _Bx); >>>> 12> ^ >>>> 12>C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0/ucrt\stddef.h:38:32: >>>> note: expanded from macro 'offsetof' >>>> 12> #define offsetof(s,m) ((size_t)&reinterpret_cast>>> volatile&>((((s*)0)->m))) >>>> >>>> >>>> The build worked with Visual Studio 2015 instead. >>>> >>>> Can I fix this issue with Visual Studio 2017 somehow? >>>> >>>> Thank you. >>>> >>>> ---------------------------------------------------------------------- >>>> Fabio D?Isidoro - PhD Student >>>> Institute of Biomechanics >>>> HPP O 14 >>>> H?nggerbergring 64 >>>> 8093 Z?rich, Switzerland >>>> >>>> >>>> -----Original Message----- >>>> From: Matt McCormick [mailto:matt.mccormick at kitware.com] >>>> Sent: Montag, 3. April 2017 20:41 >>>> To: D'Isidoro Fabio >>>> Cc: insight-users at itk.org >>>> Subject: Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) >>>> >>>> Hallo Fabio, >>>> >>>> >>>> > I use ITK with Python Wrap. I need to interface my Python code with a >>>> > Cython-wrapped C++ code that takes only numpy array as input and >>>> > returns numpy array as output. >>>> >>>> Cool. By the way, you may be interested in scikit-build [1], which is a >>>> good way to build Cython-wrapped C++ code. We are using it for the ITK and >>>> SimpleITK Python packages, and it has good Cython and CMake support. >>>> >>>> >>>> > Hence, I need to convert the Python itk images into numpy array to be >>>> > given as input to the wrapped C++ code, and then convert the numpy >>>> > array in output from the wrapped C++ code back into python itk images. >>>> > >>>> > >>>> > >>>> > Question 1) How can I do that in an efficient way? I found some posts >>>> > on itk.PyBuffer but I could not find anywhere any reference on how to >>>> > install it on my itk wrap build. >>>> >>>> Yes, itk.PyBuffer works great for that. Please review a PR for some >>>> additional documentation: >>>> >>>> https://github.com/InsightSoftwareConsortium/ITKBridgeNumPy/pull/18 >>>> >>>> This has been available in ITK for a few releases as a Remote module, >>>> which can be enabled by setting >>>> >>>> Module_BridgeNumPy=ON >>>> >>>> in ITK's CMake configuration. >>>> >>>> >>>> Since ITK 4.11.0, it is easier to build since it does not require the >>>> NumPy headers. >>>> >>>> >>>> In current ITK Git master (to be 4.12.0) the module is enabled by >>>> default. >>>> >>>> >>>> Nightly ITK Python packages for ITK Git master are now being built: >>>> >>>> https://github.com/InsightSoftwareConsortium/ITKPythonPackage >>>> >>>> macOS and Linux are available. Windows packages will be available over >>>> the coming weeks. >>>> >>>> >>>> >>>> > Question 2) The purpose of writing a part of my algorithm in C++ is to >>>> > speed up the code. If the conversion between python itk images and >>>> > numpy arrays is slow, I would lose all the speed gain obtained with >>>> the C++ implementation. >>>> > Are there better ways to deal with that? >>>> >>>> The newer versions ITKBridgeNumPy use a NumPy array view, which does >>>> not do any copies during the conversion, and it is very fast. >>>> >>>> >>>> HTH, >>>> Matt >>>> >>>> >>>> [1] http://scikit-build.org/ >>>> _____________________________________ >>>> 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 >>>> >>>> >>>> >>>> _____________________________________ >>>> 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 >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matimontg at gmail.com Wed Apr 19 16:18:38 2017 From: matimontg at gmail.com (Matias Montroull) Date: Wed, 19 Apr 2017 17:18:38 -0300 Subject: [ITK] [ITK-users] Euler3DTransform not taking user defined Center of Rotation? In-Reply-To: References: <1492470714966-38126.post@n7.nabble.com> Message-ID: Would it be because I'm compiling in Debug mode? Matias On Apr 19, 2017 2:30 PM, "Francois Budin" wrote: > Hello Matias, > > I created a small executable based on the code you sent me: > > #include > > int main(int argc, char* argv[]) > { > typedef itk::Euler3DTransform< double > TransformType; > //Transform > TransformType::Pointer transform = TransformType::New(); > double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, > centro_rotacion_Z, origenX,origenY; > gamma = atof(argv[2]); > beta = atof(argv[3]); > alfa = atof(argv[4]); > centro_rotacion_X = atof(argv[5]); > centro_rotacion_Y = atof(argv[6]); > centro_rotacion_Z = atof(argv[7]); > double centro[3] = { centro_rotacion_X, centro_rotacion_Y, > centro_rotacion_Z }; > transform->SetCenter(centro); > transform->SetRotation(gamma, beta, alfa); > std::cout<GetCenter()< std::cout<GetMatrix()< std::cout< return 0; > } > > And the results are correct: > ./Euler 10 20 30 40 50 60 70 > [50, 60, 70] > 0.56923 -0.304067 0.763885 > 0.716525 -0.272165 -0.642275 > 0.403198 0.912945 0.0629472 > > Euler3DTransform (0x1126e80) > RTTI typeinfo: itk::Euler3DTransform > Reference Count: 2 > Modified Time: 3 > Debug: Off > Object Name: > Observers: > none > Matrix: > 0.56923 -0.304067 0.763885 > 0.716525 -0.272165 -0.642275 > 0.403198 0.912945 0.0629472 > Offset: [-13.6894, 85.4629, -9.34292] > Center: [50, 60, 70] > Translation: [0, 0, 0] > Inverse: > 0.56923 0.716525 0.403198 > -0.304067 -0.272165 0.912945 > 0.763885 -0.642275 0.0629472 > Singular: 0 > Euler's angles: AngleX=20 AngleY=30 AngleZ=40 > m_ComputeZYX = 0 > > > On Wed, Apr 19, 2017 at 11:56 AM, Matias wrote: > >> Thanks Francois, >> >> There's something strange in the matrix and Offset, this is what I get: >> >> Center: >> >> [-246.422, -149.871, 20] >> >> Matrix: >> 1 0 0 >> 0 1 0 >> 0 0 1 >> >> Offset: >> [0, 0, 0] >> >> El mar., 18 de abr. de 2017 a la(s) 14:47, Francois Budin-3 [via ITK - >> Users] <[hidden email] >> > escribi?: >> >>> Hello Matias, >>> >>> I used the Euler3DTransform in a python terminal to see if I had >>> problems setting the center and the angle, and everything seems to work as >>> expected: >>> >>> trans=itk.Euler3DTransform.D.New() >>> trans.SetCenter([0,0,0]) >>> trans.SetRotation(10,0,0) >>> trans.TransformPoint([0,0,0]) >>> Out[46]: itkPointD3 ([0, 0, 0]) <-expected as the transform center is >>> [0,0,0] >>> >>> trans.SetCenter([10,0,0]) >>> trans.TransformPoint([0,0,0]) >>> Out[48]: itkPointD3 ([5.16482, -7.96596, 3.62828]) <-rotation not around >>> [0,0,0] but around [10,0,0] >>> >>> To try to understand you problem, I would advise you to print the >>> content of your transform to see if it is set as you expect. In my case, I >>> get: >>> >>> Euler3DTransform (0x18da8a0) >>> RTTI typeinfo: itk::Euler3DTransform >>> Reference Count: 1 >>> Modified Time: 377 >>> Debug: Off >>> Object Name: >>> Observers: >>> none >>> Matrix: >>> 0.483518 -0.362828 0.796596 >>> 0.796596 0.559609 -0.228631 >>> -0.362828 0.745113 0.559609 >>> Offset: [5.16482, -7.96596, 3.62828] >>> Center: [10, 0, 0] >>> Translation: [0, 0, 0] >>> Inverse: >>> 0.483518 0.796596 -0.362828 >>> -0.362828 0.559609 0.745113 >>> 0.796596 -0.228631 0.559609 >>> Singular: 0 >>> Euler's angles: AngleX=40 AngleY=10 AngleZ=10 >>> m_ComputeZYX = 0 >>> >>> Hope this helps, >>> Francois >>> >>> >>> >>> On Mon, Apr 17, 2017 at 7:11 PM, Matias <[hidden email] >>> > wrote: >>> Hi, I'm trying to rotate a volume and use an user defined center but no >>> matter what value I set, it seems the rotation is always performed using >>> the same center (not sure which, maybe a default center)? Here's the code >>> I'm using.. am I missing something? typedef itk::Euler3DTransform< double > >>> TransformType; //Transform TransformType::Pointer transform = >>> TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, >>> centro_rotacion_Y, centro_rotacion_Z, origenX,origenY; gamma = >>> atof(argv[2]); beta = atof(argv[3]); alfa = atof(argv[4]); >>> centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = atof(argv[6]); >>> centro_rotacion_Z = atof(argv[7]); double centro[3] = { centro_rotacion_X, >>> centro_rotacion_Y, centro_rotacion_Z }; transform->SetCenter(centro); >>> transform->SetRotation(gamma, beta, alfa); >>> ------------------------------ >>> View this message in context: Euler3DTransform not taking user defined >>> Center of Rotation? >>> >>> Sent from the ITK - 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 >>> >>> >> >> _____________________________________ >> 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 >> >> >> ------------------------------ >> If you reply to this email, your message will be added to the discussion >> below: >> http://itk-users.7.n7.nabble.com/Euler3DTransform-not-taking >> -user-defined-Center-of-Rotation-tp38126p38127.html >> To unsubscribe from Euler3DTransform not taking user defined Center of >> Rotation?, click here. >> NAML >> >> -- >> Matias >> >> ------------------------------ >> View this message in context: Re: [ITK-users] Euler3DTransform not >> taking user defined Center of Rotation? >> >> >> Sent from the ITK - 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 >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matimontg at gmail.com Wed Apr 19 16:31:00 2017 From: matimontg at gmail.com (Matias Montroull) Date: Wed, 19 Apr 2017 20:31:00 +0000 Subject: [ITK] [ITK-users] Euler3DTransform not taking user defined Center of Rotation? In-Reply-To: References: <1492470714966-38126.post@n7.nabble.com> Message-ID: Ok, I figured I was calling getmatrix and getoffset before the SetRotation function.. Now it works well: Centro: [-246.422, -149.871, 20] 0.999686 0.0131081 0.0213481 -0.0131859 0.999907 0.00350517 -0.0213002 -0.00378556 0.999766 [1.46023, -3.33334, -5.8115] I will check with different centers to see if the matrix changes El mi?., 19 de abr. de 2017 a la(s) 17:18, Matias Montroull < matimontg at gmail.com> escribi?: > Would it be because I'm compiling in Debug mode? > > > Matias > > On Apr 19, 2017 2:30 PM, "Francois Budin" > wrote: > >> Hello Matias, >> >> I created a small executable based on the code you sent me: >> >> #include >> >> int main(int argc, char* argv[]) >> { >> typedef itk::Euler3DTransform< double > TransformType; >> //Transform >> TransformType::Pointer transform = TransformType::New(); >> double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, >> centro_rotacion_Z, origenX,origenY; >> gamma = atof(argv[2]); >> beta = atof(argv[3]); >> alfa = atof(argv[4]); >> centro_rotacion_X = atof(argv[5]); >> centro_rotacion_Y = atof(argv[6]); >> centro_rotacion_Z = atof(argv[7]); >> double centro[3] = { centro_rotacion_X, centro_rotacion_Y, >> centro_rotacion_Z }; >> transform->SetCenter(centro); >> transform->SetRotation(gamma, beta, alfa); >> std::cout<GetCenter()<> std::cout<GetMatrix()<> std::cout<> return 0; >> } >> >> And the results are correct: >> ./Euler 10 20 30 40 50 60 70 >> [50, 60, 70] >> 0.56923 -0.304067 0.763885 >> 0.716525 -0.272165 -0.642275 >> 0.403198 0.912945 0.0629472 >> >> Euler3DTransform (0x1126e80) >> RTTI typeinfo: itk::Euler3DTransform >> Reference Count: 2 >> Modified Time: 3 >> Debug: Off >> Object Name: >> Observers: >> none >> Matrix: >> 0.56923 -0.304067 0.763885 >> 0.716525 -0.272165 -0.642275 >> 0.403198 0.912945 0.0629472 >> Offset: [-13.6894, 85.4629, -9.34292] >> Center: [50, 60, 70] >> Translation: [0, 0, 0] >> Inverse: >> 0.56923 0.716525 0.403198 >> -0.304067 -0.272165 0.912945 >> 0.763885 -0.642275 0.0629472 >> Singular: 0 >> Euler's angles: AngleX=20 AngleY=30 AngleZ=40 >> m_ComputeZYX = 0 >> >> >> On Wed, Apr 19, 2017 at 11:56 AM, Matias wrote: >> >>> Thanks Francois, >>> >>> There's something strange in the matrix and Offset, this is what I get: >>> >>> Center: >>> >>> [-246.422, -149.871, 20] >>> >>> Matrix: >>> 1 0 0 >>> 0 1 0 >>> 0 0 1 >>> >>> Offset: >>> [0, 0, 0] >>> >>> El mar., 18 de abr. de 2017 a la(s) 14:47, Francois Budin-3 [via ITK - >>> Users] <[hidden email] >>> > escribi?: >>> >>>> Hello Matias, >>>> >>>> I used the Euler3DTransform in a python terminal to see if I had >>>> problems setting the center and the angle, and everything seems to work as >>>> expected: >>>> >>>> trans=itk.Euler3DTransform.D.New() >>>> trans.SetCenter([0,0,0]) >>>> trans.SetRotation(10,0,0) >>>> trans.TransformPoint([0,0,0]) >>>> Out[46]: itkPointD3 ([0, 0, 0]) <-expected as the transform center is >>>> [0,0,0] >>>> >>>> trans.SetCenter([10,0,0]) >>>> trans.TransformPoint([0,0,0]) >>>> Out[48]: itkPointD3 ([5.16482, -7.96596, 3.62828]) <-rotation not >>>> around [0,0,0] but around [10,0,0] >>>> >>>> To try to understand you problem, I would advise you to print the >>>> content of your transform to see if it is set as you expect. In my case, I >>>> get: >>>> >>>> Euler3DTransform (0x18da8a0) >>>> RTTI typeinfo: itk::Euler3DTransform >>>> Reference Count: 1 >>>> Modified Time: 377 >>>> Debug: Off >>>> Object Name: >>>> Observers: >>>> none >>>> Matrix: >>>> 0.483518 -0.362828 0.796596 >>>> 0.796596 0.559609 -0.228631 >>>> -0.362828 0.745113 0.559609 >>>> Offset: [5.16482, -7.96596, 3.62828] >>>> Center: [10, 0, 0] >>>> Translation: [0, 0, 0] >>>> Inverse: >>>> 0.483518 0.796596 -0.362828 >>>> -0.362828 0.559609 0.745113 >>>> 0.796596 -0.228631 0.559609 >>>> Singular: 0 >>>> Euler's angles: AngleX=40 AngleY=10 AngleZ=10 >>>> m_ComputeZYX = 0 >>>> >>>> Hope this helps, >>>> Francois >>>> >>>> >>>> >>>> On Mon, Apr 17, 2017 at 7:11 PM, Matias <[hidden email] >>>> > wrote: >>>> Hi, I'm trying to rotate a volume and use an user defined center but no >>>> matter what value I set, it seems the rotation is always performed using >>>> the same center (not sure which, maybe a default center)? Here's the code >>>> I'm using.. am I missing something? typedef itk::Euler3DTransform< double > >>>> TransformType; //Transform TransformType::Pointer transform = >>>> TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, >>>> centro_rotacion_Y, centro_rotacion_Z, origenX,origenY; gamma = >>>> atof(argv[2]); beta = atof(argv[3]); alfa = atof(argv[4]); >>>> centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = atof(argv[6]); >>>> centro_rotacion_Z = atof(argv[7]); double centro[3] = { centro_rotacion_X, >>>> centro_rotacion_Y, centro_rotacion_Z }; transform->SetCenter(centro); >>>> transform->SetRotation(gamma, beta, alfa); >>>> ------------------------------ >>>> View this message in context: Euler3DTransform not taking user defined >>>> Center of Rotation? >>>> >>>> Sent from the ITK - 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 >>>> >>>> >>> >>> _____________________________________ >>> 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 >>> >>> >>> ------------------------------ >>> If you reply to this email, your message will be added to the discussion >>> below: >>> >>> http://itk-users.7.n7.nabble.com/Euler3DTransform-not-taking-user-defined-Center-of-Rotation-tp38126p38127.html >>> To unsubscribe from Euler3DTransform not taking user defined Center of >>> Rotation?, click here. >>> NAML >>> >>> -- >>> Matias >>> >>> ------------------------------ >>> View this message in context: Re: [ITK-users] Euler3DTransform not >>> taking user defined Center of Rotation? >>> >>> >>> Sent from the ITK - 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 >>> >>> >> -- Matias -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From francois.budin at kitware.com Wed Apr 19 17:35:57 2017 From: francois.budin at kitware.com (Francois Budin) Date: Wed, 19 Apr 2017 17:35:57 -0400 Subject: [ITK] [ITK-users] Euler3DTransform not taking user defined Center of Rotation? In-Reply-To: References: <1492470714966-38126.post@n7.nabble.com> Message-ID: Thank you for the update. The matrix should change when you update the center as setting the center calls the function to recompute the matrix. On Wed, Apr 19, 2017 at 4:31 PM, Matias Montroull wrote: > Ok, I figured I was calling getmatrix and getoffset before the SetRotation > function.. Now it works well: > Centro: > > [-246.422, -149.871, 20] > > 0.999686 0.0131081 0.0213481 > -0.0131859 0.999907 0.00350517 > -0.0213002 -0.00378556 0.999766 > > [1.46023, -3.33334, -5.8115] > > I will check with different centers to see if the matrix changes > > El mi?., 19 de abr. de 2017 a la(s) 17:18, Matias Montroull < > matimontg at gmail.com> escribi?: > >> Would it be because I'm compiling in Debug mode? >> >> >> Matias >> >> On Apr 19, 2017 2:30 PM, "Francois Budin" >> wrote: >> >>> Hello Matias, >>> >>> I created a small executable based on the code you sent me: >>> >>> #include >>> >>> int main(int argc, char* argv[]) >>> { >>> typedef itk::Euler3DTransform< double > TransformType; >>> //Transform >>> TransformType::Pointer transform = TransformType::New(); >>> double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, >>> centro_rotacion_Z, origenX,origenY; >>> gamma = atof(argv[2]); >>> beta = atof(argv[3]); >>> alfa = atof(argv[4]); >>> centro_rotacion_X = atof(argv[5]); >>> centro_rotacion_Y = atof(argv[6]); >>> centro_rotacion_Z = atof(argv[7]); >>> double centro[3] = { centro_rotacion_X, centro_rotacion_Y, >>> centro_rotacion_Z }; >>> transform->SetCenter(centro); >>> transform->SetRotation(gamma, beta, alfa); >>> std::cout<GetCenter()<>> std::cout<GetMatrix()<>> std::cout<>> return 0; >>> } >>> >>> And the results are correct: >>> ./Euler 10 20 30 40 50 60 70 >>> [50, 60, 70] >>> 0.56923 -0.304067 0.763885 >>> 0.716525 -0.272165 -0.642275 >>> 0.403198 0.912945 0.0629472 >>> >>> Euler3DTransform (0x1126e80) >>> RTTI typeinfo: itk::Euler3DTransform >>> Reference Count: 2 >>> Modified Time: 3 >>> Debug: Off >>> Object Name: >>> Observers: >>> none >>> Matrix: >>> 0.56923 -0.304067 0.763885 >>> 0.716525 -0.272165 -0.642275 >>> 0.403198 0.912945 0.0629472 >>> Offset: [-13.6894, 85.4629, -9.34292] >>> Center: [50, 60, 70] >>> Translation: [0, 0, 0] >>> Inverse: >>> 0.56923 0.716525 0.403198 >>> -0.304067 -0.272165 0.912945 >>> 0.763885 -0.642275 0.0629472 >>> Singular: 0 >>> Euler's angles: AngleX=20 AngleY=30 AngleZ=40 >>> m_ComputeZYX = 0 >>> >>> >>> On Wed, Apr 19, 2017 at 11:56 AM, Matias wrote: >>> >>>> Thanks Francois, >>>> >>>> There's something strange in the matrix and Offset, this is what I get: >>>> >>>> Center: >>>> >>>> [-246.422, -149.871, 20] >>>> >>>> Matrix: >>>> 1 0 0 >>>> 0 1 0 >>>> 0 0 1 >>>> >>>> Offset: >>>> [0, 0, 0] >>>> >>>> El mar., 18 de abr. de 2017 a la(s) 14:47, Francois Budin-3 [via ITK - >>>> Users] <[hidden email] >>>> > escribi?: >>>> >>>>> Hello Matias, >>>>> >>>>> I used the Euler3DTransform in a python terminal to see if I had >>>>> problems setting the center and the angle, and everything seems to work as >>>>> expected: >>>>> >>>>> trans=itk.Euler3DTransform.D.New() >>>>> trans.SetCenter([0,0,0]) >>>>> trans.SetRotation(10,0,0) >>>>> trans.TransformPoint([0,0,0]) >>>>> Out[46]: itkPointD3 ([0, 0, 0]) <-expected as the transform center is >>>>> [0,0,0] >>>>> >>>>> trans.SetCenter([10,0,0]) >>>>> trans.TransformPoint([0,0,0]) >>>>> Out[48]: itkPointD3 ([5.16482, -7.96596, 3.62828]) <-rotation not >>>>> around [0,0,0] but around [10,0,0] >>>>> >>>>> To try to understand you problem, I would advise you to print the >>>>> content of your transform to see if it is set as you expect. In my case, I >>>>> get: >>>>> >>>>> Euler3DTransform (0x18da8a0) >>>>> RTTI typeinfo: itk::Euler3DTransform >>>>> Reference Count: 1 >>>>> Modified Time: 377 >>>>> Debug: Off >>>>> Object Name: >>>>> Observers: >>>>> none >>>>> Matrix: >>>>> 0.483518 -0.362828 0.796596 >>>>> 0.796596 0.559609 -0.228631 >>>>> -0.362828 0.745113 0.559609 >>>>> Offset: [5.16482, -7.96596, 3.62828] >>>>> Center: [10, 0, 0] >>>>> Translation: [0, 0, 0] >>>>> Inverse: >>>>> 0.483518 0.796596 -0.362828 >>>>> -0.362828 0.559609 0.745113 >>>>> 0.796596 -0.228631 0.559609 >>>>> Singular: 0 >>>>> Euler's angles: AngleX=40 AngleY=10 AngleZ=10 >>>>> m_ComputeZYX = 0 >>>>> >>>>> Hope this helps, >>>>> Francois >>>>> >>>>> >>>>> >>>>> On Mon, Apr 17, 2017 at 7:11 PM, Matias <[hidden email] >>>>> > wrote: >>>>> Hi, I'm trying to rotate a volume and use an user defined center but >>>>> no matter what value I set, it seems the rotation is always performed using >>>>> the same center (not sure which, maybe a default center)? Here's the code >>>>> I'm using.. am I missing something? typedef itk::Euler3DTransform< double > >>>>> TransformType; //Transform TransformType::Pointer transform = >>>>> TransformType::New(); double alfa, beta, gamma, centro_rotacion_X, >>>>> centro_rotacion_Y, centro_rotacion_Z, origenX,origenY; gamma = >>>>> atof(argv[2]); beta = atof(argv[3]); alfa = atof(argv[4]); >>>>> centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = atof(argv[6]); >>>>> centro_rotacion_Z = atof(argv[7]); double centro[3] = { centro_rotacion_X, >>>>> centro_rotacion_Y, centro_rotacion_Z }; transform->SetCenter(centro); >>>>> transform->SetRotation(gamma, beta, alfa); >>>>> ------------------------------ >>>>> View this message in context: Euler3DTransform not taking user >>>>> defined Center of Rotation? >>>>> >>>>> Sent from the ITK - 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 >>>>> >>>>> >>>> >>>> _____________________________________ >>>> 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 >>>> >>>> >>>> ------------------------------ >>>> If you reply to this email, your message will be added to the >>>> discussion below: >>>> http://itk-users.7.n7.nabble.com/Euler3DTransform-not- >>>> taking-user-defined-Center-of-Rotation-tp38126p38127.html >>>> To unsubscribe from Euler3DTransform not taking user defined Center of >>>> Rotation?, click here. >>>> NAML >>>> >>>> -- >>>> Matias >>>> >>>> ------------------------------ >>>> View this message in context: Re: [ITK-users] Euler3DTransform not >>>> taking user defined Center of Rotation? >>>> >>>> >>>> Sent from the ITK - 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 >>>> >>>> >>> -- > Matias > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From jonathan.lefman at intel.com Wed Apr 19 21:43:30 2017 From: jonathan.lefman at intel.com (Lefman, Jonathan) Date: Thu, 20 Apr 2017 01:43:30 +0000 Subject: [ITK] [ITK-dev] ITK now used in Intel Compiler build validation Message-ID: Hi ITK dev community, The Intel ICC compiler team is now using ITK as part of its build validation. We hope this step will be a benefit to both ITK and the Intel Compiler. -Jon -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _______________________________________________ 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://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-developers From hans-johnson at uiowa.edu Thu Apr 20 09:35:33 2017 From: hans-johnson at uiowa.edu (Johnson, Hans J) Date: Thu, 20 Apr 2017 13:35:33 +0000 Subject: [ITK] [ITK-dev] ITK now used in Intel Compiler build validation Message-ID: That is spectacular news! Hans -- From: Insight-developers on behalf of "Lefman, Jonathan" Date: Wednesday, April 19, 2017 at 8:43 PM To: ITK Developers Subject: [ITK-dev] ITK now used in Intel Compiler build validation Hi ITK dev community, The Intel ICC compiler team is now using ITK as part of its build validation. We hope this step will be a benefit to both ITK and the Intel Compiler. -Jon -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _______________________________________________ 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://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-developers From matt.mccormick at kitware.com Thu Apr 20 18:26:32 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Thu, 20 Apr 2017 18:26:32 -0400 Subject: [ITK] [ITK-users] Beta ITK Python packages are now available for testing! Message-ID: Hi folks, We now have binary ITK Python packages available for testing! To install, run python -m pip install --upgrade pip python -m pip install itk -f https://github.com/InsightSoftwareConsortium/ITKPythonPackage/releases/tag/latest These are beta packages that are created on a daily basis. We have packages for Linux, macOSX, and Windows for Python 2.7, 3.5, and 3.6, along with source distributions (sdist's). Please share your experiences with these packages. Initial testing suggests that these packages work both with system Python distributions, Python distributions downloaded from python.org, and Anaconda Python distributions. Thanks, Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From francois.budin at kitware.com Fri Apr 21 08:51:54 2017 From: francois.budin at kitware.com (Francois Budin) Date: Fri, 21 Apr 2017 08:51:54 -0400 Subject: [ITK] [ITK-users] Beta ITK Python packages are now available for testing! In-Reply-To: References: Message-ID: This is great news! On Thu, Apr 20, 2017 at 6:26 PM, Matt McCormick wrote: > Hi folks, > > We now have binary ITK Python packages available for testing! To install, > run > > python -m pip install --upgrade pip > python -m pip install itk -f https://github.com/ > InsightSoftwareConsortium/ITKPythonPackage/releases/tag/latest > > These are beta packages that are created on a daily basis. We have > packages for Linux, macOSX, and Windows for Python 2.7, 3.5, and 3.6, along > with source distributions (sdist's). Please share your experiences with > these packages. Initial testing suggests that these packages work both with > system Python distributions, Python distributions downloaded from > python.org, and Anaconda Python distributions. > > Thanks, > Matt > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From nmeshram at wisc.edu Fri Apr 21 21:49:39 2017 From: nmeshram at wisc.edu (Nirvedh Meshram) Date: Sat, 22 Apr 2017 01:49:39 +0000 Subject: [ITK] 3D iterator goes out of bounds but still works Message-ID: Hello All, I am working on a Code which is using an iterator which access pixels beyond the region boundary. However, this is not causing an error as I would expect it to. I need to use version 4.0 for legacy reasons. I am attaching a verifiable code and its output with this issue. Let me know if this is a bug in my ITK version or I am missing something and this is correct behavior. #include "itkImage.h" #include "itkImageRegionIterator.h" #include "itkVersion.h" int main( int argc, char * argv[] ) { typedef float InputPixelType; typedef itk::Image< InputPixelType, 3 > InputImageType; InputImageType::Pointer ip=InputImageType::New(); InputPixelType *input; InputImageType::RegionType region,region1; InputImageType::SizeType size,size1; InputImageType::IndexType index,index1; size[0]=5; size[1]=5; size[2]=5; index[0]=0; index[1]=0; index[2]=0; region.SetSize(size); region.SetIndex(index); std::cout<SetRegions(region); ip->Allocate(); size[2]=1; region.SetSize(size); std::cout< Iteratortype; Iteratortype It(ip,region); int count=0; for(It.GoToBegin();count<25*5;count++,++It) { It.Set(27); } input=ip->GetBufferPointer(); for(int k=0;k<5;k++) { for(int i=0;i<5;i++) { for(int j=0;j<5;j++) { std::cout<GetITKMajorVersion()<<"."<GetITKMinorVersion()<<"\n"; return EXIT_SUCCESS; } Output: ImageRegion (0x7ffcfc489560) Dimension: 3 Index: [0, 0, 0] Size: [5, 5, 5] ImageRegion (0x7ffcfc489560) Dimension: 3 Index: [0, 0, 0] Size: [5, 5, 1] 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 4.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: From drcjaudet at gmail.com Sat Apr 22 04:42:49 2017 From: drcjaudet at gmail.com (Cyril Jaudet) Date: Sat, 22 Apr 2017 10:42:49 +0200 Subject: [ITK] Grey Level Size Zone Matrix In-Reply-To: <6346FDA89B3182498B2DCBE06FD04B8D015A5F4E@UPHMASPHI027.UPHS.PENNHEALTH.PRV> References: <6346FDA89B3182498B2DCBE06FD04B8D015A5F21@UPHMASPHI027.UPHS.PENNHEALTH.PRV> <6346FDA89B3182498B2DCBE06FD04B8D015A5F4E@UPHMASPHI027.UPHS.PENNHEALTH.PRV> Message-ID: So, here the code. You need an image and a label. The calculation of the texture will be into the label. You normally have to preprocess the image to a specific number of greylevel, usualy 256 for CT, 64 for PET... They can be adjusted with maxValue and minValue. MaxVolume is the maximal volume in number of voxel that you expect a zone will have, if you don't now just use the volume of the lesion but it can be process consuming. Also i crop the image and the label before starting the analyse to spare some ressource. It's a small part f a big program so i hope i didn't forget any part. Tell me if you have problem with it or see an error in the code. Best regards, Cyril Jaudet, PhD Medical Physicist UZBrussel, Radiotherapy You will have to initialise all the filter but that itk basic stuff like: ?????????????????????????????????????????????????????????????????????? #include "itkBinaryThresholdImageFilter.h" #include "itkConnectedComponentImageFilter.h" #include "itkLabelGeometryImageFilter.h" //maybe i have forgetted some just add then in this case. typedef itk::BinaryThresholdImageFilter BinaryThresholdImageFilterType2_GSZM; typedef itk::ConnectedComponentImageFilter ConnectedComponentImageFilterType_GSZM; typedef itk::LabelGeometryImageFilter LabelGeometryImageFilterType_GSZM; //biblio general #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include const unsigned int ImageDimension = 3; typedef float PixelType; typedef itk::Image ImageType; typedef itk::Image LabelType; //initialise les vecteurs: int num_of_col = Max_Value+1; int num_of_row = Max_Volume+1; int init_value = 0; // std::cout << " num_of_col: " << num_of_col << std::endl; // std::cout << " num_of_row: " << num_of_row << std::endl; // std::cout << " Rmax_init: " << Rmax_init << std::endl; vector volume_all ; //now we have an empty 1D-matrix of size (0). Resizing it with one single command: volume_all.resize( num_of_col, 0 ); vector< vector > ZM; //now we have an empty 2D-matrix of size (0,0). Resizing it with one single command: ZM.resize( num_of_col , vector( num_of_row , init_value ) ); //fill the matrix for each distance with the number of grey value vector< vector > matrix_GLDZM; //now we have an empty 2D-matrix of size (0,0). Resizing it with one single command: matrix_GLDZM.resize( Max_Value+1 , vector(Rmax_init+1 , init_value) ); //----------------------------------------------GSZM: ImageType::Pointer image_GSZM = cropFilter->GetOutput(); image_GSZM->Update(); LabelType::Pointer label_GSZM = LabelcropFilter->GetOutput(); label_GSZM->Update(); int MaxValue=256; int MinValue=0; //////////////////////////////////////////:::Connected composants analysis///////////////////////////////////: // intiate filter: BinaryThresholdImageFilterType2_GSZM::Pointer thresholdFilterToBinary_GSZM= BinaryThresholdImageFilterType2_GSZM::New(); ConnectedComponentImageFilterType_GSZM::Pointer connected_GSZM = ConnectedComponentImageFilterType_GSZM::New (); LabelGeometryImageFilterType_GSZM::Pointer labelGeometryImageFilter_GSZM = LabelGeometryImageFilterType_GSZM::New(); //Maximum volume of the mask: int D=int(maxValue-minValue); //std::cout << " Print D : " << D << std::endl; // int volume_all[int(D)]; float R; //now we have an empty 1D-matrix of size (0). Refill it with one single command: std::fill(volume_all.begin(), volume_all.end(), 0); /*for(int k=minValue; k<(maxValue+1); k++){ //all resampled Value are between 0 and D volume_all[k]=0; std::cout << " Initiale levels : " << k <<" volume : "<ItI_GSZM(image_GSZM,image_GSZM->GetLargestPossibleRegion()); itk::ImageRegionIteratorItM_GSZM(label_GSZM,label_GSZM->GetLargestPossibleRegion()); int level=0; for ( ItI_GSZM.GoToBegin(), ItM_GSZM.GoToBegin();!ItI_GSZM.IsAtEnd(); ++ItI_GSZM, ++ItM_GSZM ) { if ( int(ItM_GSZM.Get()) ==A_label ) { level=ItI_GSZM.Get(); volume_all[level]=volume_all[level]+1; } } int mask_volume=0; int level_mask_volume=0; for(int k=minValue; k<(maxValue+1); k++){ if (mask_volume(num_of_row) ) ; //std::cout << "MaskImage initialaise 1"<< std::endl; int volume=0; int Max_volume=0; int Min_volume=mask_volume; int N_object_connect=0; for(int level_Grey=minValue; level_Grey<(maxValue+1); level_Grey++ ) { //choose one levels of Grey (D levels) thresholdFilterToBinary_GSZM->SetInput(image_GSZM); thresholdFilterToBinary_GSZM->SetLowerThreshold(int(level_Grey)); thresholdFilterToBinary_GSZM->SetUpperThreshold(int(level_Grey)); thresholdFilterToBinary_GSZM->SetInsideValue(int(level_Grey)); thresholdFilterToBinary_GSZM->SetOutsideValue(0); thresholdFilterToBinary_GSZM->Update(); //look at the connectivity between voxels each zone is save in a different label connected_GSZM->SetInput(thresholdFilterToBinary_GSZM->GetOutput()); connected_GSZM->SetFullyConnected(1); connected_GSZM->Update(); //std::cout << "Number of objects for D= "<GetObjectCount() << std::endl; N_object_connect=0; N_object_connect=connected_GSZM->GetObjectCount(); //measure the volume of each labels labelGeometryImageFilter_GSZM->SetInput(connected_GSZM->GetOutput() ); labelGeometryImageFilter_GSZM->SetIntensityInput(image_GSZM); labelGeometryImageFilter_GSZM->Update(); //store in the Thibault matrix for(int N=1; NGetVolume(N); ZM[level_Grey][volume]++; // std::cout << "Grey value of: "<volume ) {Min_volume=volume;} } //inputImage->DisconnectPipeline(); } //std::cout << "GSZM create"<< std::endl; std::cout << "max volume :"<< Max_volume<< std::endl; //////////////////////////////////////////////////////////////////////////////////////////////////: /////////////////////convert size zone matrix to an histogram////// typedef itk::Statistics::SparseFrequencyContainer2 FrequencyContainerType_GSZM; typedef FrequencyContainerType_GSZM::AbsoluteFrequencyType FrequencyType_GSZM; typedef itk::Statistics::Histogram< float, FrequencyContainerType_GSZM> HistogramType_GSZM; unsigned int numberOfComponents=2; HistogramType_GSZM::Pointer histogram = HistogramType_GSZM::New(); HistogramType_GSZM::SizeType size(numberOfComponents); size[0]=D; size[1]=(Max_volume-Min_volume); HistogramType_GSZM::MeasurementVectorType lowerBound(numberOfComponents); lowerBound[0]=0; lowerBound[1]=0; HistogramType_GSZM::MeasurementVectorType upperBound(numberOfComponents); upperBound[0]=(maxValue-minValue); upperBound[1]=Max_volume-1; histogram->SetMeasurementVectorSize(numberOfComponents); histogram->Initialize(size, lowerBound, upperBound ); histogram->SetToZero(); // std::cout << "Histogramme created: middle "<< std::endl; HistogramType_GSZM::IndexType index(numberOfComponents); for(int level_Grey=minValue; level_Grey<(maxValue+1); level_Grey++ ) { for(int N=0; N<(Max_volume);N++) { index[0]=(level_Grey-minValue); //the calulation add +1 to the two index index[1]=N; histogram->SetFrequencyOfIndex(index, static_cast(ZM[level_Grey][N+1])); /* if (N==(1) ) { std::cout << "index: "< HistoSizeFilterType; HistoSizeFilterType::Pointer hzf= HistoSizeFilterType::New(); hzf->SetInput(histogram); //hzf->FastCalculationsOn();//just one direction hzf->Update(); std::cout<<" GSZM: ok"<GetShortRunEmphasis()<<"\t"; fichier<GetLongRunEmphasis()<<"\t"; fichier<GetGreyLevelNonuniformity()<<"\t"; fichier<GetRunLengthNonuniformity()<<"\t"; fichier<GetLowGreyLevelRunEmphasis()<<"\t"; fichier<GetHighGreyLevelRunEmphasis()<<"\t"; fichier<GetShortRunLowGreyLevelEmphasis()<<"\t"; fichier<GetShortRunHighGreyLevelEmphasis()<<"\t"; fichier<GetLongRunLowGreyLevelEmphasis()<<"\t"; fichier<GetLongRunHighGreyLevelEmphasis()<<"\t"; ?????????????????????????????????????????????????????????????????? 2017-04-21 19:31 GMT+02:00 Pati, Sarthak : > Hi Cyril, > > > > Sure, that would be fine, as long as there is nothing missing. > > > > Thanks so much, > > Sarthak > > > > *From:* Cyril Jaudet [mailto:drcjaudet at gmail.com] > *Sent:* 21/Apr/2017; Friday 13:31 > *To:* Pati, Sarthak > *Subject:* Re: Grey Level Size Zone Matrix > > > > Hello Pati, > > I just have the code that work fine. I'll send it to you tomorrow. It is > ok if i just give the corresponding part because now it is a part of a > bigger code. > > See you, > > Cyril Jaudet, PhD > > Medical physicist > > UZBrussel, Belgium > > > > 2017-04-21 18:10 GMT+02:00 Pati, Sarthak : > > Hi, > > > > I saw your post on the ITK forums (http://public.kitware.com/ > pipermail/community/2015-January/008102.html) and I wanted to know if you > had that code available somewhere? I was looking for an implementation for > a project and would gladly refer to your work for this. > > > > Thanks, > > Sarthak Pati > > Lead Software Developer > > Center for Biomedical Image Computing & Analytics > > University of Pennsylvania > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fisidoro at ethz.ch Sat Apr 22 11:48:44 2017 From: fisidoro at ethz.ch (D'Isidoro Fabio) Date: Sat, 22 Apr 2017 15:48:44 +0000 Subject: [ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa) In-Reply-To: References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> Message-ID: <50B858FB5F53124F9E32314E5C1B40944597AC46@MBX212.d.ethz.ch> Thank you Matt, I am looking now at scikit-build. Do you think I can use it to build C++/CUDA accelerated codes that use ITK too? Is there a link to a simple example of how to setup a scikit-build for an ITK-based C++ code? Thank you, Fabio. -----Original Message----- From: Matt McCormick [mailto:matt.mccormick at kitware.com] Sent: Montag, 3. April 2017 20:41 To: D'Isidoro Fabio Cc: insight-users at itk.org Subject: Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) Hallo Fabio, > I use ITK with Python Wrap. I need to interface my Python code with a > Cython-wrapped C++ code that takes only numpy array as input and > returns numpy array as output. Cool. By the way, you may be interested in scikit-build [1], which is a good way to build Cython-wrapped C++ code. We are using it for the ITK and SimpleITK Python packages, and it has good Cython and CMake support. > Hence, I need to convert the Python itk images into numpy array to be > given as input to the wrapped C++ code, and then convert the numpy > array in output from the wrapped C++ code back into python itk images. > > > > Question 1) How can I do that in an efficient way? I found some posts > on itk.PyBuffer but I could not find anywhere any reference on how to > install it on my itk wrap build. Yes, itk.PyBuffer works great for that. Please review a PR for some additional documentation: https://github.com/InsightSoftwareConsortium/ITKBridgeNumPy/pull/18 This has been available in ITK for a few releases as a Remote module, which can be enabled by setting Module_BridgeNumPy=ON in ITK's CMake configuration. Since ITK 4.11.0, it is easier to build since it does not require the NumPy headers. In current ITK Git master (to be 4.12.0) the module is enabled by default. Nightly ITK Python packages for ITK Git master are now being built: https://github.com/InsightSoftwareConsortium/ITKPythonPackage macOS and Linux are available. Windows packages will be available over the coming weeks. > Question 2) The purpose of writing a part of my algorithm in C++ is to > speed up the code. If the conversion between python itk images and > numpy arrays is slow, I would lose all the speed gain obtained with the C++ implementation. > Are there better ways to deal with that? The newer versions ITKBridgeNumPy use a NumPy array view, which does not do any copies during the conversion, and it is very fast. HTH, Matt [1] http://scikit-build.org/ _____________________________________ 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 From zhuangming.shen at sphic.org.cn Mon Apr 24 03:54:40 2017 From: zhuangming.shen at sphic.org.cn (=?utf-8?B?5rKI5bqE5piO?=) Date: Mon, 24 Apr 2017 07:54:40 +0000 Subject: [ITK] [ITK-users] Reconstruct non-transverse scanned MR images Message-ID: <1493020478635.58701@sphic.org.cn> ?Hi all, I have a set of DICOM MR images which is scanned in Coronal, not Transverse. As a result, when I reconstructed them to a 3D volume using ITK, its orientation seems to be not the same as the that of the Transverse scanned 3D volume, whose orientation is standard LPS. My questions are (1) Should I reorientation the Coronal scanned 3D volume to standard LPS orientation? (2) If need, should I use itk.OrientImageFilter to do that? Or use any other methods? (3) If need use itk.OrientImageFilter, how to write "orienter->SetDesiredCoordinateOrientation(itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_LPS)" using Python? Thanks in advance. Regards, Zhuangming Shen ? -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From tevain at telecom-paristech.fr Mon Apr 24 10:59:54 2017 From: tevain at telecom-paristech.fr (Timothee Evain) Date: Mon, 24 Apr 2017 16:59:54 +0200 (CEST) Subject: [ITK] Level set with shape prior In-Reply-To: <2123082733.4520850.1493044553702.JavaMail.zimbra@enst.fr> Message-ID: <1266167915.4540440.1493045994809.JavaMail.zimbra@enst.fr> Hello everyone, I'm trying the level-set segmentation with shape guidance as described in the manual guide; the one based on the Leventon et al. paper "Statistical shape influence in geodesic active contours". https://itk.org/Doxygen/html/Examples_2Segmentation_2GeodesicActiveContourShapePriorLevelSetImageFilter_8cxx-example.html Unfortunately, I fail to make it works correctly : when I look at the shape prior during optimization, after the initialization with an usual centering helper, it "drifts" away of the feature image until it disappears, which obviously leads to weird segmentation behavior. I've tried to toy with parameters, setting high weight on gradient term (the only one that actually links the shape with the feature map) in MAP cost function, but nothing make it right. It feels like the shape prior make no sense. Also, the example include an optimization through the OnePlusOneEvolutionary, and I'm not sure random permutation is the best way to achieve good prior. In the paper they used a gradient ascent, so I tried the gradient descent, but alas the cost function does not support derivative-based optimization. Have anyone applied this method successfully on their data ? Any hints welcomed Thanks in advance Tim From blowekamp at mail.nih.gov Mon Apr 24 11:35:59 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Mon, 24 Apr 2017 15:35:59 +0000 Subject: [ITK] [ITK-users] releaseData flag, partial update in a complex pipeline In-Reply-To: <6b521a71-d7b7-8361-76cf-0cd3dba9a1d7@yahoo.fr> References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B40944597AC46@MBX212.d.ethz.ch> <6b521a71-d7b7-8361-76cf-0cd3dba9a1d7@yahoo.fr> Message-ID: <41F1BDD4-8A68-4998-A1C7-5A3B2DF9D544@mail.nih.gov> Hello, To the best of my knowledge and experience with the ITK pipeline, when the output of a filter ( H or R ) is used as multiple inputs with the ReleaseData, the data from the output ( H or R ) will be release after _each_ filter which use that output data. So the result is that the minimal amount of memory is consumed! But in a complex pipeline like yours filters will be executed multiple times for a single update. Based on your comments you likely want to set only R and W to ReleaseData automatically. This ensures that all the inputs to M are cached and available. The trade off is that R will get execute twice. Alternatively, you could just manually release the output of R after execution. HTH, Brad On Apr 22, 2017, at 12:46 PM, asertyuio via Insight-users > wrote: Dear Users, I have trouble applying the concepts behind the release data flag, and memory management of itk to a particular problem. I?m developing a filter with, for part of it, it a rather complex mini pipeline. H, R, RS, W, WS and M are itk filters. The filter will be updated frequently, and I?m trying to make the update only update necessary parts, while keeping memory imprinting as low as possible. Here is a schematic, simplified graph representing my filter : H | \ v \ R \ -> take as input a parameter P1 that do not change often | \ / \ /\ v v v | RS W | | | | | v | \ WS | \ | / v v v M -> takes parameters P2 that are often updated I would like to be able to release the output data of the filter R and of the filter W, updating them only if the parameter P1 change (which would trigger update for the whole pipeline), while still being able to change P2 without having to recalculate R, W and RS. I think it may be possible with the releaseData flag, don?t really understand where it should be putted, and if this will do what I need. Thanks a lot for you help ! Yann ? _____________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matt.mccormick at kitware.com Mon Apr 24 13:37:54 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Mon, 24 Apr 2017 13:37:54 -0400 Subject: [ITK] 3D iterator goes out of bounds but still works In-Reply-To: References: Message-ID: Hi Nirvedh, For performance reasons, the iterators do not do bounds-checking. HTH, Matt On Fri, Apr 21, 2017 at 9:49 PM, Nirvedh Meshram wrote: > Hello All, > > > I am working on a Code which is using an iterator which access pixels > beyond the region boundary. However, this is not causing an error as I > would expect it to. I need to use version 4.0 for legacy reasons. I am > attaching a verifiable code and its output with this issue. Let me know if > this is a bug in my ITK version or I am missing something and this is > correct behavior. > > > #include "itkImage.h" > #include "itkImageRegionIterator.h" > #include "itkVersion.h" > int main( int argc, char * argv[] ) > { > typedef float InputPixelType; > typedef itk::Image< InputPixelType, 3 > InputImageType; > > InputImageType::Pointer ip=InputImageType::New(); > InputPixelType *input; > InputImageType::RegionType region,region1; > InputImageType::SizeType size,size1; > InputImageType::IndexType index,index1; > size[0]=5; > size[1]=5; > size[2]=5; > index[0]=0; > index[1]=0; > index[2]=0; > > region.SetSize(size); > region.SetIndex(index); > std::cout< ip->SetRegions(region); > ip->Allocate(); > size[2]=1; > region.SetSize(size); > std::cout< typedef itk::ImageRegionIterator Iteratortype; > Iteratortype It(ip,region); > int count=0; > for(It.GoToBegin();count<25*5;count++,++It) > { > It.Set(27); > } > input=ip->GetBufferPointer(); > for(int k=0;k<5;k++) > { > for(int i=0;i<5;i++) > { > for(int j=0;j<5;j++) > { > std::cout< } > std::cout<<"\n"; > > } > std::cout<<"\n"; > } > itk::Version *Ver=itk::Version::New(); > std::cout<GetITKMajorVersion()<<"."<< > Ver->GetITKMinorVersion()<<"\n"; > > > > return EXIT_SUCCESS; > } > > Output: > > > ImageRegion (0x7ffcfc489560) > Dimension: 3 > Index: [0, 0, 0] > Size: [5, 5, 5] > ImageRegion (0x7ffcfc489560) > Dimension: 3 > Index: [0, 0, 0] > Size: [5, 5, 1] > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > 27 27 27 27 27 > > 4.0 > > > > > _______________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.mccormick at kitware.com Mon Apr 24 13:39:51 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Mon, 24 Apr 2017 13:39:51 -0400 Subject: [ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa) In-Reply-To: <50B858FB5F53124F9E32314E5C1B40944597AC46@MBX212.d.ethz.ch> References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B40944597AC46@MBX212.d.ethz.ch> Message-ID: Hi Fabio, Yes, building Python extensions that depend on libraries like Cuda is muich easier with CMake build system support in scikit-build. I will follow up with an example of how to set up scikit-build for ITK-based C++ code. Thanks, Matt On Sat, Apr 22, 2017 at 11:48 AM, D'Isidoro Fabio wrote: > Thank you Matt, > > I am looking now at scikit-build. > > Do you think I can use it to build C++/CUDA accelerated codes that use ITK > too? > > Is there a link to a simple example of how to setup a scikit-build for an > ITK-based C++ code? > > Thank you, > Fabio. > > -----Original Message----- > From: Matt McCormick [mailto:matt.mccormick at kitware.com] > Sent: Montag, 3. April 2017 20:41 > To: D'Isidoro Fabio > Cc: insight-users at itk.org > Subject: Re: [ITK-users] ITK Python: numpy to itk image (and viceversa) > > Hallo Fabio, > > > > I use ITK with Python Wrap. I need to interface my Python code with a > > Cython-wrapped C++ code that takes only numpy array as input and > > returns numpy array as output. > > Cool. By the way, you may be interested in scikit-build [1], which is a > good way to build Cython-wrapped C++ code. We are using it for the ITK and > SimpleITK Python packages, and it has good Cython and CMake support. > > > > Hence, I need to convert the Python itk images into numpy array to be > > given as input to the wrapped C++ code, and then convert the numpy > > array in output from the wrapped C++ code back into python itk images. > > > > > > > > Question 1) How can I do that in an efficient way? I found some posts > > on itk.PyBuffer but I could not find anywhere any reference on how to > > install it on my itk wrap build. > > Yes, itk.PyBuffer works great for that. Please review a PR for some > additional documentation: > > https://github.com/InsightSoftwareConsortium/ITKBridgeNumPy/pull/18 > > This has been available in ITK for a few releases as a Remote module, > which can be enabled by setting > > Module_BridgeNumPy=ON > > in ITK's CMake configuration. > > > Since ITK 4.11.0, it is easier to build since it does not require the > NumPy headers. > > > In current ITK Git master (to be 4.12.0) the module is enabled by default. > > > Nightly ITK Python packages for ITK Git master are now being built: > > https://github.com/InsightSoftwareConsortium/ITKPythonPackage > > macOS and Linux are available. Windows packages will be available over the > coming weeks. > > > > > Question 2) The purpose of writing a part of my algorithm in C++ is to > > speed up the code. If the conversion between python itk images and > > numpy arrays is slow, I would lose all the speed gain obtained with the > C++ implementation. > > Are there better ways to deal with that? > > The newer versions ITKBridgeNumPy use a NumPy array view, which does not > do any copies during the conversion, and it is very fast. > > > HTH, > Matt > > > [1] http://scikit-build.org/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From blowekamp at mail.nih.gov Tue Apr 25 13:19:14 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Tue, 25 Apr 2017 17:19:14 +0000 Subject: [ITK] [ITK-users] releaseData flag, partial update in a complex pipeline In-Reply-To: References: <50B858FB5F53124F9E32314E5C1B409445967065@MBX212.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B40944597AC46@MBX212.d.ethz.ch> <6b521a71-d7b7-8361-76cf-0cd3dba9a1d7@yahoo.fr> <41F1BDD4-8A68-4998-A1C7-5A3B2DF9D544@mail.nih.gov> Message-ID: <04F6A8B8-8E44-4728-85F9-EB96958EC0B9@mail.nih.gov> Hello, You also need to graft the input and output so that updates and propagation of the mini-pipeline does not propagate beyond the mini-pipeline[1] [2]. Your approach sounds about right. But there are a lot of stumbling block with this approach and just a couple ways to do everything ?proper?. Also this goal of ?caching? the internal data, is not what is generally done in ITK. Most filters in ITK, prefer to release the data and keep memory usage to a minimum. It frequently turns out, that keeping a pipeline?s memory foot print small is important to fast execution and allows the processing to scale to larger data sets too. The ?ReleaseData? flag does not cause the pipeline to be re-executed. You will have to examine the pipeline code and the time stamps of the relevant objects to determine the effect of ?manual? releasing the data, and how to best do it for your situation. HTH, Brad [1] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/ImageFeature/include/itkUnsharpMaskImageFilter.hxx#L78-L79 [2] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/ImageFeature/include/itkUnsharpMaskImageFilter.hxx#L100-L102 On Apr 25, 2017, at 11:55 AM, asertyuio via Insight-users > wrote: Thanks for your answer Brad ! Just to confirm that I understood well: To unsure that only the needed parts are actualized I call the global update, I need to: * use the H, R, RS, W, WS, M filters as members * set up their relationships in the filter constructor * do the update at the M filter Then I can call manually releaseData on the R and W filter after the call to M update(). And that should do the trick, and release data should not make the downstream filters RS and WS to update, right ? Ok, after rereading what the software guide tells about that: Filter execution occurs when a) the filter is modified as a result of modifying an instance variable; b) the input to the filter changes; c) the input data has been released ? ITK Software guide p. 200 So it seems like if I release the data of W or R, updating M will force WS and RS to update? Am I wrong ? If I want the filter to have the expected behavior, Is it possible to trigger the update manually ? I?m thinking of disconnecting RS and WS by using new smart pointers for R and W output, checking manually the modified state to conditionally call update when relevant. Yann Le 24/04/2017 ? 17:35, Lowekamp, Bradley (NIH/NLM/LHC) [C] a ?crit : Hello, To the best of my knowledge and experience with the ITK pipeline, when the output of a filter ( H or R ) is used as multiple inputs with the ReleaseData, the data from the output ( H or R ) will be release after _each_ filter which use that output data. So the result is that the minimal amount of memory is consumed! But in a complex pipeline like yours filters will be executed multiple times for a single update. Based on your comments you likely want to set only R and W to ReleaseData automatically. This ensures that all the inputs to M are cached and available. The trade off is that R will get execute twice. Alternatively, you could just manually release the output of R after execution. HTH, Brad On Apr 22, 2017, at 12:46 PM, asertyuio via Insight-users > wrote: Dear Users, I have trouble applying the concepts behind the release data flag, and memory management of itk to a particular problem. I?m developing a filter with, for part of it, it a rather complex mini pipeline. H, R, RS, W, WS and M are itk filters. The filter will be updated frequently, and I?m trying to make the update only update necessary parts, while keeping memory imprinting as low as possible. Here is a schematic, simplified graph representing my filter : H | \ v \ R \ -> take as input a parameter P1 that do not change often | \ / \ /\ v v v | RS W | | | | | v | \ WS | \ | / v v v M -> takes parameters P2 that are often updated I would like to be able to release the output data of the filter R and of the filter W, updating them only if the parameter P1 change (which would trigger update for the whole pipeline), while still being able to change P2 without having to recalculate R, W and RS. I think it may be possible with the releaseData flag, don?t really understand where it should be putted, and if this will do what I need. Thanks a lot for you help ! Yann ? _____________________________________ 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 ? _____________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From francois.budin at kitware.com Wed Apr 26 08:13:18 2017 From: francois.budin at kitware.com (Francois Budin) Date: Wed, 26 Apr 2017 08:13:18 -0400 Subject: [ITK] [ITK-users] Understanding ITK_COMPUTER_MEMORY_SIZE parameter in CMake In-Reply-To: <1493194073402-7589858.post@n2.nabble.com> References: <1493194073402-7589858.post@n2.nabble.com> Message-ID: Hello, This parameter is used to assess if certain tests are run. If the value is too low (I think under 8GB), a few tests will not be run. It will not have any inpact on the ITK library and how it is compiled. Hope this helps, Francois On Wed, Apr 26, 2017 at 4:07 AM, Butterfly via Insight-users < insight-users at itk.org> wrote: > Hello everyone, > > I cannot understand the purpose of the ITK_COMPUTER_MEMORY_SIZE parameter > in > CMake. I build ITK on a computer that has 8GB RAM, so I set this parameter > to 8. > > 1) Will the program fail on computers with < 8GB RAM ? > 2) Will the program fail on computers with >= 8GB RAM, but on 32Bit OS (so > with RAM usage limited to 4) ? > 3) Will the program use ONLY 8GB of available RAM on computers with >> 8GB > RAM ? > > Thank you very much in advance! > > > > > > > -- > View this message in context: http://itk-insight-users. > 2283740.n2.nabble.com/Understanding-ITK-COMPUTER-MEMORY-SIZE-parameter-in- > CMake-tp7589858.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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From mrguilfoyle at gmail.com Thu Apr 27 07:28:19 2017 From: mrguilfoyle at gmail.com (Mathew Guilfoyle) Date: Thu, 27 Apr 2017 12:28:19 +0100 Subject: [ITK] [ITK-users] SimpleITK SyN and BSpline SyN Deformable Registration Message-ID: <6F7BFBD1-E001-45D4-AF06-82016879CCA0@gmail.com> Hello Is there any prospect of the itk::SyNImageRegistrationMethod and its::BSplineSyNImageRegistrationMethod deformable registration algorithms being made available via SimpleITK? Thanks _____________________________________ 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 From blowekamp at mail.nih.gov Thu Apr 27 08:57:51 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Thu, 27 Apr 2017 12:57:51 +0000 Subject: [ITK] [ITK-users] SimpleITK SyN and BSpline SyN Deformable Registration In-Reply-To: <6F7BFBD1-E001-45D4-AF06-82016879CCA0@gmail.com> References: <6F7BFBD1-E001-45D4-AF06-82016879CCA0@gmail.com> Message-ID: Hello Mathew, It has not come up as a priority yet. Can you please add two feature requests to SimpleITK?s Github Issue tracker [1]. In general though ANTs is the go to interface for using the SyN algorithms [2] for most common applications. [1] https://github.com/SimpleITK/SimpleITK/issues [2] http://stnava.github.io/ANTs/ > On Apr 27, 2017, at 7:28 AM, Mathew Guilfoyle wrote: > > Hello > > Is there any prospect of the itk::SyNImageRegistrationMethod and its::BSplineSyNImageRegistrationMethod deformable registration algorithms being made available via SimpleITK? > > Thanks > _____________________________________ > 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 _____________________________________ 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 From fisidoro at ethz.ch Thu Apr 27 16:58:07 2017 From: fisidoro at ethz.ch (D'Isidoro Fabio) Date: Thu, 27 Apr 2017 20:58:07 +0000 Subject: [ITK] [ITK-users] ITK PyBuffer get physical point coordinates Message-ID: <50B858FB5F53124F9E32314E5C1B409445984B2A@MBX112.d.ethz.ch> Hallo, I know it's possible to get a numpy array of an itk image with: itk.PyBuffer[ImageType].GetArrayFromImage(Image) Is it by any chance also possible to obtain a (flattended) numpy array of the physical coordinates of the image pixels too? Thank you! -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From blowekamp at mail.nih.gov Thu Apr 27 17:16:17 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Thu, 27 Apr 2017 21:16:17 +0000 Subject: [ITK] [ITK-users] ITK PyBuffer get physical point coordinates In-Reply-To: <50B858FB5F53124F9E32314E5C1B409445984B2A@MBX112.d.ethz.ch> References: <50B858FB5F53124F9E32314E5C1B409445984B2A@MBX112.d.ethz.ch> Message-ID: Hi! You can generate an image of the physical locations of each pixel with the PhysicalPointImageSource filter: https://itk.org/Doxygen/html/classitk_1_1PhysicalPointImageSource.html Very recently added is the SetReferenceImage, which can be use to copy the meta data from one image to the parameters of this filter. If your version is not super recent then you can manually set the Size, Spacing, Origin, Direction and StartIndex. After you generate the point image you should be able to convert to with the same method. HTH, Brad On Apr 27, 2017, at 4:58 PM, D'Isidoro Fabio > wrote: Hallo, I know it?s possible to get a numpy array of an itk image with: itk.PyBuffer[ImageType].GetArrayFromImage(Image) Is it by any chance also possible to obtain a (flattended) numpy array of the physical coordinates of the image pixels too? Thank you! _____________________________________ 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 _______________________________________________ Community mailing list Community at itk.org http://public.kitware.com/mailman/listinfo/community -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From shindinobot at gmail.com Thu Apr 27 22:45:02 2017 From: shindinobot at gmail.com (Shaw-Peng Yang) Date: Fri, 28 Apr 2017 10:45:02 +0800 Subject: [ITK] [ITK-users] Remove me from this mailing list Message-ID: To Whom it may concern, Please remove me from this mailing list. Thanks, -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From indianzeppelin at gmail.com Fri Apr 28 03:20:46 2017 From: indianzeppelin at gmail.com (Girish Mallya) Date: Fri, 28 Apr 2017 08:20:46 +0100 Subject: [ITK] [ITK-users] Remove me from this mailing list In-Reply-To: References: Message-ID: Hi Shaw-Peng, You can do that yourself using the subscribe/unsubscribe link. Here it is - http://public.kitware.com/mailman/listinfo/insight-users. On 28 Apr 2017 3:45 am, "Shaw-Peng Yang" wrote: To Whom it may concern, Please remove me from this mailing list. Thanks, _____________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From fisidoro at ethz.ch Fri Apr 28 12:05:03 2017 From: fisidoro at ethz.ch (D'Isidoro Fabio) Date: Fri, 28 Apr 2017 16:05:03 +0000 Subject: [ITK] [ITK-users] ITK PyBuffer get physical point coordinates In-Reply-To: References: <50B858FB5F53124F9E32314E5C1B409445984B2A@MBX112.d.ethz.ch> Message-ID: <50B858FB5F53124F9E32314E5C1B409445984BBC@MBX112.d.ethz.ch> Thank you for your reply. 1) I have tried as a first step the following: DRRPhy = itk.PhysicalPointImageSource[itk.Image[itk.Point[itk.F, Dimension], Dimension]].New() But I get the error: KeyError: "itkTemplate : No template (, 3) for the itk::Image class" So I guess I can?t generate an image with itk.Points as PixelType. Therefore I chose to use a VectorImage as ImageType in Input to the PhysicalPointImageSource. sourceImage = itk.PhysicalPointImageSource[itk.VectorImage[itk.F, Dimension]].New() sourceImage.SetSize(size) sourceImage.SetSpacing(spacing) sourceImage.SetOrigin(origin) #DRRPhy.SetIndex(start) it does not work, how to set the start index? DRRPhy.SetDirection(direction) 2) However, using PyBuffer to get a numpy array form that does not work: sourceImageArray = itk.PyBuffer[ImageType].GetArrayFromImage(sourceImage) I get the error: AttributeError: 'itkPhysicalPointImageSourceVIF3' object has no attribute 'GetLargestPossibleRegion' Am I doing the right thing in point 1) ? How could I solve point 2) ? Thank you ! Fabio. From: Lowekamp, Bradley (NIH/NLM/LHC) [C] [mailto:blowekamp at mail.nih.gov] Sent: Donnerstag, 27. April 2017 23:16 To: D'Isidoro Fabio Cc: insight-users at itk.org Subject: Re: [ITK] [ITK-users] ITK PyBuffer get physical point coordinates Hi! You can generate an image of the physical locations of each pixel with the PhysicalPointImageSource filter: https://itk.org/Doxygen/html/classitk_1_1PhysicalPointImageSource.html Very recently added is the SetReferenceImage, which can be use to copy the meta data from one image to the parameters of this filter. If your version is not super recent then you can manually set the Size, Spacing, Origin, Direction and StartIndex. After you generate the point image you should be able to convert to with the same method. HTH, Brad On Apr 27, 2017, at 4:58 PM, D'Isidoro Fabio > wrote: Hallo, I know it?s possible to get a numpy array of an itk image with: itk.PyBuffer[ImageType].GetArrayFromImage(Image) Is it by any chance also possible to obtain a (flattended) numpy array of the physical coordinates of the image pixels too? Thank you! _____________________________________ 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 _______________________________________________ Community mailing list Community at itk.org http://public.kitware.com/mailman/listinfo/community -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From KevinSeanLee at live.com Fri Apr 28 13:25:57 2017 From: KevinSeanLee at live.com (Sean Lee) Date: Fri, 28 Apr 2017 17:25:57 +0000 Subject: [ITK] [ITK-users] multiple itk filters in vtk pipeline issue Message-ID: I am trying to apply image processing with itk through vtk pipeline. It seems no problems with single itk filter, but did not work well with multiple itk filters. The pseudo code is as following: in constructor: m_ItkImage = ItkImageType::New(); m_ItkImageFilter = ItkImageFilterType::New(); in image processing function: m_ItkImage gets an image from vtk pipeline m_ItkImageFilter->SetInput(m_ItkImage); m_ItkImageFilter->Update(); m_ItkImageFilter->GetOutput() was sent back to the vtk pipeline I debugged the m_ItkImage and m_ItkImageFilter->GetOutput(), and saw that m_ItkImage was updated but m_ItkImageFilter was not through the vtk pipeline. How can I make m_ItkImageFilter->GetOutput() updated too through the vtk pipeline? Thank you for your time. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From aharr8 at uwo.ca Fri Apr 28 16:10:59 2017 From: aharr8 at uwo.ca (Andrew Harris) Date: Fri, 28 Apr 2017 16:10:59 -0400 Subject: [ITK] [ITK-users] CommandIterationUpdate optimizer position reporting Message-ID: Hello, I'm attempting to track the movement of images under registration using various optimizers. I have a CommandIterationUpdate observer set up to write the optimizer positions to file, and when I use a Gradient Descent or Powell optimizer I get a vector for the translation applied using optimizer->GetCurrentPosition(), however if I use the LBFGSB optimizer I get zero vectors all the way down (it returns the correct result though). Is the functionality of GetCurrentPosition() different in the LBFGSB optimizer than the others? -- AH ----------------------------------------------------------------------------------------------- *This email and any attachments thereto may contain private, confidential, and privileged materials for the sole use of the intended recipient. Any reviewing, copying, or distribution of this email (or any attachments thereto) by other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently destroy this email and any attachments thereto.* -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From francois.budin at kitware.com Fri Apr 28 17:11:55 2017 From: francois.budin at kitware.com (Francois Budin) Date: Fri, 28 Apr 2017 17:11:55 -0400 Subject: [ITK] [ITK-users] ITK PyBuffer get physical point coordinates In-Reply-To: <50B858FB5F53124F9E32314E5C1B409445984BBC@MBX112.d.ethz.ch> References: <50B858FB5F53124F9E32314E5C1B409445984B2A@MBX112.d.ethz.ch> <50B858FB5F53124F9E32314E5C1B409445984BBC@MBX112.d.ethz.ch> Message-ID: Hello Fabio, I was able to use this filter in Python. Here is the commands I typed: In [14]: ImageType=itk.Image[itk.Vector[itk.F,2],2] In [15]: source=itk.PhysicalPointImageSource[ImageType].New() In [16]: source.SetSize([5,5]) In [17]: source.SetOrigin([0,0]) In [18]: source.SetSpacing([.5,.5]) In [19]: source.Update() In [20]: itk.GetArrayFromImage(source) Out[20]: itkndarray([[[ 0. , 0. ], [ 0.5, 0. ], [ 1. , 0. ], [ 1.5, 0. ], [ 2. , 0. ]], [[ 0. , 0.5], [ 0.5, 0.5], [ 1. , 0.5], [ 1.5, 0.5], [ 2. , 0.5]], [[ 0. , 1. ], [ 0.5, 1. ], [ 1. , 1. ], [ 1.5, 1. ], [ 2. , 1. ]], [[ 0. , 1.5], [ 0.5, 1.5], [ 1. , 1.5], [ 1.5, 1.5], [ 2. , 1.5]], [[ 0. , 2. ], [ 0.5, 2. ], [ 1. , 2. ], [ 1.5, 2. ], [ 2. , 2. ]]], dtype=float32) It also worked with VectorImages: In [22]: ImageType=itk.VectorImage[itk.F,2] In [23]: source=itk.PhysicalPointImageSource[ImageType].New() In [24]: source.SetOrigin([0,0]) In [25]: source.SetSize([5,5]) In [26]: source.SetSpacing([.5,.5]) In [27]: source.Update() In [28]: itk.GetArrayFromImage(source) To answer your questions: 1) This filter is only wrapped over image of vectors and vector images. You can have the list of types that are available in Python with itk.PhysicalPointImageSource.GetTypes() 2) You may have a version of ITK Python for which VectorImage is not wrapped for PyBuffer. You can try to update your ITK Python [1] Hope this helps, Francois [1] https://github.com/InsightSoftwareConsortium/ITKPythonPackage On Fri, Apr 28, 2017 at 12:05 PM, D'Isidoro Fabio wrote: > Thank you for your reply. > > > > 1) I have tried as a first step the following: > > > > DRRPhy = itk.PhysicalPointImageSource[itk.Image[itk.Point[itk.F, > Dimension], Dimension]].New() > > > > But I get the error: > > > > KeyError: "itkTemplate : No template (, > 3) for the itk::Image class" > > > > So I guess I can?t generate an image with itk.Points as PixelType. > Therefore I chose to use a VectorImage as ImageType in Input to the > PhysicalPointImageSource. > > > > sourceImage = itk.PhysicalPointImageSource[itk.VectorImage[itk.F, > Dimension]].New() > > sourceImage.SetSize(size) > > sourceImage.SetSpacing(spacing) > > sourceImage.SetOrigin(origin) > > #DRRPhy.SetIndex(start) it does not work, how to set the start index? > > DRRPhy.SetDirection(direction) > > > > 2) However, using PyBuffer to get a numpy array form that does not > work: > > > > sourceImageArray = itk.PyBuffer[ImageType].GetArrayFromImage(sourceImage) > > > > I get the error: > > > > AttributeError: 'itkPhysicalPointImageSourceVIF3' object has no attribute > 'GetLargestPossibleRegion' > > > > > > Am I doing the right thing in point 1) ? > > How could I solve point 2) ? > > > > Thank you ! > > > > Fabio. > > > > *From:* Lowekamp, Bradley (NIH/NLM/LHC) [C] [mailto:blowekamp at mail.nih.gov] > > *Sent:* Donnerstag, 27. April 2017 23:16 > *To:* D'Isidoro Fabio > *Cc:* insight-users at itk.org > *Subject:* Re: [ITK] [ITK-users] ITK PyBuffer get physical point > coordinates > > > > Hi! > > > > You can generate an image of the physical locations of each pixel with the > PhysicalPointImageSource filter: > > https://itk.org/Doxygen/html/classitk_1_1PhysicalPointImageSource.html > > > > Very recently added is the SetReferenceImage, which can be use to copy the > meta data from one image to the parameters of this filter. If your version > is not super recent then you can manually set the Size, Spacing, Origin, > Direction and StartIndex. > > > > After you generate the point image you should be able to convert to with > the same method. > > > > HTH, > > Brad > > > > > > On Apr 27, 2017, at 4:58 PM, D'Isidoro Fabio wrote: > > > > Hallo, > > > > I know it?s possible to get a numpy array of an itk image with: > > > > itk.PyBuffer[ImageType].GetArrayFromImage(Image) > > > > Is it by any chance also possible to obtain a (flattended) numpy array of > the physical coordinates of the image pixels too? > > > > Thank you! > > > > _____________________________________ > 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 > _______________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community > > > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From matt.mccormick at kitware.com Fri Apr 28 18:59:56 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Fri, 28 Apr 2017 18:59:56 -0400 Subject: [ITK] [ITK-users] multiple itk filters in vtk pipeline issue In-Reply-To: References: Message-ID: Hi Sean, There are two filters in the ITKVTKGlue module (it has to be enabled explicitly in your ITK build with the Module_ITKVTKGlue option) that are used to glue together ITK and VTK pipelines. See these examples: https://itk.org/ITKExamples/src/Bridge/VtkGlue/ConvertAnitkImageTovtkImageData/Documentation.html https://itk.org/ITKExamples/src/Bridge/VtkGlue/ConvertvtkImageDataToAnitkImage/Documentation.html Hope this helps, Matt On Fri, Apr 28, 2017 at 1:25 PM, Sean Lee wrote: > I am trying to apply image processing with itk through vtk pipeline. It > seems no problems with single itk filter, but did not work well with > multiple itk filters. The pseudo code is as following: > > > in constructor: > > > m_ItkImage = ItkImageType::New(); > > m_ItkImageFilter = ItkImageFilterType::New(); > > > in image processing function: > > > m_ItkImage gets an image from vtk pipeline > > > m_ItkImageFilter->SetInput(m_ItkImage); > > m_ItkImageFilter->Update(); > > > m_ItkImageFilter->GetOutput() was sent back to the vtk pipeline > > > I debugged the m_ItkImage and m_ItkImageFilter->GetOutput(), and saw that > m_ItkImage was updated but m_ItkImageFilter was not through the vtk > pipeline. > > > How can I make m_ItkImageFilter->GetOutput() updated too through the vtk > pipeline? > > > Thank you for your time. > > > > > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Sat Apr 29 13:54:09 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Sat, 29 Apr 2017 13:54:09 -0400 Subject: [ITK] [ITK-users] CommandIterationUpdate optimizer position reporting In-Reply-To: References: Message-ID: Hi Andrew, different optimizers have different behavior (e.g. small steps vs big steps), but even the programming interface is not uniform. Some functions are called differently e.g. maximumSteps vs iterationCount etc. You should look at the respective examples for each optimizer which you plan to use to see how iteration tracking is set up. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Fri, Apr 28, 2017 at 4:10 PM, Andrew Harris wrote: > Hello, > I'm attempting to track the movement of images under registration using > various optimizers. I have a CommandIterationUpdate observer set up to > write the optimizer positions to file, and when I use a Gradient Descent or > Powell optimizer I get a vector for the translation applied using > optimizer->GetCurrentPosition(), however if I use the LBFGSB optimizer I > get zero vectors all the way down (it returns the correct result though). > Is the functionality of GetCurrentPosition() different in the LBFGSB > optimizer than the others? > > -- > > AH > > > ------------------------------------------------------------ > ----------------------------------- > > *This email and any attachments thereto may contain private, > confidential, and privileged materials for the sole use of the intended > recipient. Any reviewing, copying, or distribution of this email (or any > attachments thereto) by other than the intended recipient is strictly > prohibited. If you are not the intended recipient, please contact the > sender immediately and permanently destroy this email and any attachments > thereto.* > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From aharr8 at uwo.ca Sat Apr 29 14:15:01 2017 From: aharr8 at uwo.ca (Andrew Harris) Date: Sat, 29 Apr 2017 14:15:01 -0400 Subject: [ITK] [ITK-users] [itk] Unhandled exception when using Mean Squares and Powell Optimizer Message-ID: Hello, I'm getting an exception saying too many samples are outside the moving image buffer when I use the MeanSquaresImageToImageMetric with the PowellOptimizer that doesn't occur when I use NormalizedCorrelationImageToImageMetric or MattesMutualInformationImageToImageMetric. I thought it might be because the optimizer is seeking to maximize the metric so I tried calling MaximizeOff on it but got the same exception. Any ideas would be appreciated. -- AH ----------------------------------------------------------------------------------------------- *This email and any attachments thereto may contain private, confidential, and privileged materials for the sole use of the intended recipient. Any reviewing, copying, or distribution of this email (or any attachments thereto) by other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently destroy this email and any attachments thereto.* -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Sat Apr 29 15:46:06 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Sat, 29 Apr 2017 15:46:06 -0400 Subject: [ITK] [ITK-users] [itk] Unhandled exception when using Mean Squares and Powell Optimizer In-Reply-To: References: Message-ID: Hi Andrew, if this is happening on the first iteration, your initial parameters do not overlap your images well. If this is happening in some later iteration, the other optimizer might be veering of course during optimization, pushing your images apart and ultimately causing the error. From experience, the initial parameters are almost always to blame. Regards, D?enan On Sat, Apr 29, 2017 at 2:15 PM, Andrew Harris wrote: > Hello, > I'm getting an exception saying too many samples are outside the moving > image buffer when I use the MeanSquaresImageToImageMetric with the > PowellOptimizer that doesn't occur when I use > NormalizedCorrelationImageToImageMetric or MattesMutualInformationImageToImageMetric. > I thought it might be because the optimizer is seeking to maximize the > metric so I tried calling MaximizeOff on it but got the same exception. > Any ideas would be appreciated. > > -- > > AH > > > ------------------------------------------------------------ > ----------------------------------- > > *This email and any attachments thereto may contain private, > confidential, and privileged materials for the sole use of the intended > recipient. Any reviewing, copying, or distribution of this email (or any > attachments thereto) by other than the intended recipient is strictly > prohibited. If you are not the intended recipient, please contact the > sender immediately and permanently destroy this email and any attachments > thereto.* > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From swetha.bsharma at gmail.com Sat Apr 29 22:40:58 2017 From: swetha.bsharma at gmail.com (Swetha Sharma) Date: Sun, 30 Apr 2017 08:10:58 +0530 Subject: [ITK] [ITK-users] function to find if image has foreground pixels in binaryvolume Message-ID: Hi All, I am looking for a function which checks existence of foreground pixel in binary volume. -swetha -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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 From dzenanz at gmail.com Sun Apr 30 10:36:29 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Sun, 30 Apr 2017 10:36:29 -0400 Subject: [ITK] [ITK-users] function to find if image has foreground pixels in binaryvolume In-Reply-To: References: Message-ID: Hi Swetha, combine image->TransformPhysicalPointToIndex() to see if the point is in the image and image->GetPixel() to check whether the value is greater than zero. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Sat, Apr 29, 2017 at 10:40 PM, Swetha Sharma wrote: > Hi All, > > I am looking for a function which checks existence of foreground pixel in > binary volume. > -swetha > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _____________________________________ 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