@@ -655,6 +655,50 @@ VTKPolyDataMeshIO::ReadMeshInformation()
655655 this ->m_NumberOfPointPixelComponents = this ->m_PointDimension * (this ->m_PointDimension + 1 ) / 2 ;
656656 this ->m_UpdatePointData = true ;
657657 }
658+ if (line.find (" FIELD" ) != std::string::npos)
659+ {
660+ StringStreamType sss;
661+ sss << line;
662+
663+ sss >> item; // should be "FIELD"
664+ if (item == " FIELD" )
665+ {
666+ sss >> item; // field data name (e.g. "FieldData")
667+ sss >> item; // number of field data arrays
668+ const int numArrays = std::stoi (item);
669+ if (numArrays >= 1 )
670+ {
671+ // Read the first field data array header.
672+ // Additional arrays are silently skipped.
673+ std::getline (inputFile, line, ' \n ' );
674+
675+ StringStreamType fieldStream;
676+ fieldStream << line;
677+ fieldStream >> item; // array name
678+
679+ fieldStream >> item; // numComponents
680+ const unsigned int numComponents = std::stoi (item);
681+
682+ fieldStream >> item; // numTuples
683+ const unsigned int numTuples = std::stoi (item);
684+
685+ fieldStream >> item; // data type
686+ const IOComponentEnum componentType = this ->GetComponentTypeFromString (item);
687+
688+ if (this ->m_NumberOfPoints == numTuples)
689+ {
690+ this ->m_NumberOfPointPixelComponents = numComponents;
691+ this ->m_PointPixelType = IOPixelEnum::VARIABLELENGTHVECTOR;
692+ this ->m_PointPixelComponentType = componentType;
693+ if (this ->m_PointPixelComponentType == IOComponentEnum::UNKNOWNCOMPONENTTYPE)
694+ {
695+ itkExceptionMacro (" Unknown point pixel component type" );
696+ }
697+ this ->m_UpdatePointData = true ;
698+ }
699+ }
700+ }
701+ }
658702 }
659703 else if (line.find (" CELL_DATA" ) != std::string::npos)
660704 {
@@ -788,6 +832,50 @@ VTKPolyDataMeshIO::ReadMeshInformation()
788832 this ->m_NumberOfCellPixelComponents = this ->m_PointDimension * (this ->m_PointDimension + 1 ) / 2 ;
789833 this ->m_UpdateCellData = true ;
790834 }
835+ if (line.find (" FIELD" ) != std::string::npos)
836+ {
837+ StringStreamType sss;
838+ sss << line;
839+
840+ sss >> item; // should be "FIELD"
841+ if (item == " FIELD" )
842+ {
843+ sss >> item; // field data name (e.g. "FieldData")
844+ sss >> item; // number of field data arrays
845+ const int numArrays = std::stoi (item);
846+ if (numArrays >= 1 )
847+ {
848+ // Read the first field data array header.
849+ // Additional arrays are silently skipped.
850+ std::getline (inputFile, line, ' \n ' );
851+
852+ StringStreamType fieldStream;
853+ fieldStream << line;
854+ fieldStream >> item; // array name
855+
856+ fieldStream >> item; // numComponents
857+ const unsigned int numComponents = std::stoi (item);
858+
859+ fieldStream >> item; // numTuples
860+ const unsigned int numTuples = std::stoi (item);
861+
862+ fieldStream >> item; // data type
863+ const IOComponentEnum componentType = this ->GetComponentTypeFromString (item);
864+
865+ if (this ->m_NumberOfCells == numTuples)
866+ {
867+ this ->m_NumberOfCellPixelComponents = numComponents;
868+ this ->m_CellPixelType = IOPixelEnum::VARIABLELENGTHVECTOR;
869+ this ->m_CellPixelComponentType = componentType;
870+ if (this ->m_CellPixelComponentType == IOComponentEnum::UNKNOWNCOMPONENTTYPE)
871+ {
872+ itkExceptionMacro (" Unknown cell pixel component type" );
873+ }
874+ this ->m_UpdateCellData = true ;
875+ }
876+ }
877+ }
878+ }
791879 }
792880 else if (line.find (" OFFSETS" ) != std::string::npos)
793881 {
0 commit comments